Filed under: Programming
Counting the Time
In this program I have moved on from the previous stage. By referring to my hand drawn flow chart I was able to identify each stage of the counting process. By adding let b0= 31 at the beginning of label 41 it reset the counting on the minutes digit to zero and starts counting up to 9 again. Each time the minutes digit counts to 9 and resets it triggers the let b1= b1-1 which counts the tens of minutes digit. So every ten cycles the ten minute digit moves from 0 to 1 this continues to 5 and starts at 0 again. I then enter let b1= 47 at label 51 and b2= 79 at label 52 this process starts each of the digits at 0 after counting. Then it was just a case of counting each digit up to its correct number. From the tens of hours I counted 0 to 2 and for the hours 0 to 4. This gives the clock a 24 hour time display. On reflection I identified the need for the hours digit to count 0 to 9 twice and at 23:59 the hours digit needs to reset at 0.
Timing the Clock
This section of the program involved using for and next commands. These were used as tools to loop a section of the program. The program without these commands runs far too quickly to give a real time reading. These commands delay a section of the program by looping a number of times before continuing with the program. By selecting the amount of times I want these to loop dictates the timing of the minutes, which drives the other three digits. After experimenting with a stop watch I found two for next commands set at 150 were pretty accurate for setting the clock.
No Comments Yet so far
Leave a comment
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>