Hello,
I think the following code is not doing what you expect.
Timerset = $292B ' 22 ms with prescale of 1:2 dec 10541
The above line looks like it is setting the value of a variable.
movlw LOW(Timerset) ; 1 instruction cycle
This line takes the address of the variable in ram, it does not use its value.
addwf TMR1L,F ; 1 instruction cycle
movlw HIGH(Timerset) ; 1 instruction cycle
addwfc TMR1H,F ; 1 instruction cycle
If you never change the timeout value, you could change to something like
TIMERSET EQU $292B
and the movlw LOW(TIMERSET) will work.
If you want to change the timeout value at runtime
use something like
movfw TimerSet+1 ; Get the low byte of TimerSet variable
addwf TMR1L, F
movfw TimerSet ; Get the high byte of TimerSet variable
addwfc TMR1H, F
Keith
Bookmarks