EASy68K  
It is currently Mon Feb 24, 2020 9:07 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Timer 0 to 10 Minutes
PostPosted: Fri Dec 27, 2019 2:00 pm 
Offline

Joined: Fri Dec 27, 2019 12:58 pm
Posts: 2
Hello,
I am busy trying to code a 0 to 10 minutes timer. The time will be displayed on the screen as mm:ss.tenths.
I have coded several subroutines so far. At the moment I am at the stage where the program will display the time in minutes, seconds and tenths of seconds.
At the start of the program I read the system time in 100ths of seconds and then divide by 10 and discard the remainder so my start time is in 10ths of seconds. I then enter an infinite loop. In the loop I read the current time and convert it to 10ths of seconds and store it in memory as current time. I use a subroutine to find the elapsed time (current time - base time). I use another subroutine to calculate the timer values in minutes, second and tenths. First I divide by 600 to give mins and store in memory. Next I use the remainder and divide by 10 to give seconds with the remainder in 10ths of seconds.
Then I use a subroutine to display the values on screen. This works OK and shows these values incrementing on the screen. My problem is that when the seconds reaches 59 seconds and then rolls over to 0 I still have the 9 on the screen next to the new seconds count. I have fixed the problem by overwriting the 9 with a space which works OK but it just seems like a fudge to make it right. So my question is there a better way to do this?

I have done some 8086 assembly in the past but the M68000 is all new territory for me but I have learned a lot so far with this program. Most of the programming I have done is in higher level languages C++, VB, Pascal, also currently trying to learn C. So my approach which may not be the best is to use mainly subroutines which helps me to organise my code so I can keep track of what I do.


Top
 Profile  
 
PostPosted: Sun Dec 29, 2019 12:22 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1118
It sounds good to me.

_________________
Prof. Kelly


Top
 Profile  
 
PostPosted: Thu Jan 02, 2020 7:36 am 
Offline

Joined: Fri Dec 27, 2019 12:58 pm
Posts: 2
Thank you for your response. I have since found a better way to correct the problem with the seconds display.
I display a zero before the seconds using the CMP instruction from 0-9: 01,02,03...09. Above nine it counts in the normal way, 11, 12...59
and then rolls over to 00 which now works fine.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group