incrementing 16 bit timer value
I have TMR1 loaded with $FC7C, using the commands TMR1H=$FC and TMR1L=$7C.
I was hoping to make this one variable like T1Val=$FC7C so that I can increment or decrement this timer value. Can this be done? Can I concantenate both bytes as in T1Val=TMR1H +TMR1L (where T1Val var word)?
Re: incrementing 16 bit timer value
Sure you can do what you want.
T1Val var word
T1Val = $FC7C
TMR1L = T1Val.BYTE0
TMR1H = T1Val.BYTE1
Re: incrementing 16 bit timer value
So I can write: T1Val=T1Val+1 resulting in T1Val incrementing from FC7C to FC7D?
Re: incrementing 16 bit timer value
Yes.
The "Using Scaler Variables" section in the PBP manual describes this.
You can do this:
T1Val = $FC7C
T1Val = T1Val + 1 ' $FC7D
TMR1L = T1Val.BYTE0 ' $7D
TMR1H = T1Val.BYTE1 ' $FC
Timer1 now equals $FC7D