Truncated match.
PICList
Thread
'Timer 1 rollover on 16c73'
1999\01\24@182240
by
Adam Lyness
|
On the 16C73 I'm using Timer 1 free running and need to get
the current value of the timer precisely. As you may be
reading either high or low bytes as the other is rolling over
you must check for the rollover and reread if necessary. This
is fine except that I now do not know the timer value precisely
as requested. I can recify this by taking a constant from the
read value (if it took the long route).
Hence the problem, at what point in the fetch/decode stage is the
timer incremented. Also if it is a rollover is the carry out
asyncronous and at what point would the high byte be incremented
based on the carry being set.
Here is the offending code:
movf TMR1H,W
movwf var_timH
movf TMR1L,W
movwf var_timL
//check if overflow
movf TMR1H,W
subwf var_timH,W
btfsc STATUS,2 //bit 2 is zero bit
goto Continue
movf TMR1H,W
movwf var_timH
movf TMR1L,W
movwf var_timL
// Fiddle to get timer value correct independant of
// above route to get timer
//
// If (var_timL <= ?VALUE?-1)
// var_timH = var_timH -1
//
// var_timL = var_timL - ?VALUE?
Continue:
...
...
...
Here's hoping someone can help.
Cheers.
Shane Buckham
spam_OUTarl37TakeThisOuT
cad.canterbury.ac.nz
More... (looser matching)
- Last day of these posts
- In 1999
, 2000 only
- Today
- New search...