Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/08/04 08:55
Read: times


 
#70008 - RE: need some ideas..
Responding to: ???'s previous message
With the low digit second count, i don't mean a timer directly.

Overflow is when you run out of bits while you are counting up. In general, not exclusively regarding the timers.

Underflow is also when you run out of bits, but while you are counting down.

You will know you have overflowed if after the increment you look at the number, and it turns out to have become 0.

You will know you have underflowed if after the decrement you look at the number and it turns out to have become all 1's.

So to count the low seconds:

     dec  losec     ; decrease seconds (units)
     mov  a,losec   ; get the value to a for testing
     cpl  a         ; If it was 0ffh, it will be 0 now
     jnz  ....      ; Jump away if you didn't underflow

     mov  losec,#9  ; reload seconds (units) with 9
     dec  hisec     ; decrease seconds (tens)
     ...
 

You are a little bit confused about what the timer is used for in my idea. It is, as you presumed correctly, not possible to make the controller's timers count down. The timers can only count up and overflow. But that doesn't matter. All you need is a time interval. Whether the timer is running up or down, you don't care. It is not the value of the timer that you are going to work with, it's the periodic interrupt it can generate that you're interested in.
Read my first post again and see that I don't use the controller's timer immediately as digits of the clock; I use it as a steady beat the main loop can march to, and that is where the actual numerical clock is with all its seconds, minutes and hours.

List of 11 messages in thread
TopicAuthorDate
need some ideas..            01/01/70 00:00      
   RE: need some ideas..            01/01/70 00:00      
   RE: need some ideas..            01/01/70 00:00      
      RE: need some ideas..            01/01/70 00:00      
      RE: need some ideas..            01/01/70 00:00      
         RE: need some ideas..            01/01/70 00:00      
   RE: need some ideas..            01/01/70 00:00      
      RE: need some ideas..            01/01/70 00:00      
         RE: need some ideas..            01/01/70 00:00      
   First things first            01/01/70 00:00      
   RE: need some ideas..            01/01/70 00:00      

Back to Subject List