
Originally Posted by
skimask
Ok, I got you...
It may depend on the PIC, not sure, the datasheets will tell.
But...
I'm looking at the 18F4620 datasheet, there's a section in there under Timer 1 that talks about 8 bit vs 16 bit Timer 1 writes.
Basically, you can't go TMR1 = var, you do actually have to use 2 8bit writes. You can't directly access TMR1H, it gets buffered in the 16 bit R/W mode. (section 12.2 of the 18F4620 datasheet)
Okay perfect - that is exactly what I'm asking, and now the follow up...
What is the exact syntax to split off the high and low bits? That really is my confusion at this point. I want to do something like this, but I'm not sure the syntax...
Code:
myHolder VAR WORD
''' stop timer, which is now holding the result I want to measure
myHolder (the low byte) = TMR1L
myHolder (the high byte) = TMR1H
myHolder = myHolder - 200
''' now I'll goto another sub where I'm using the timeout as a trial
TMR1L = (the low byte of myHolder)
TMR1H = (the high byte of myHolder)
'
So I guess I'm just asking for the syntax of how to reference a high bit or a low bit in or out of a 16-bit variable, and also to clairify that once I have the value in "myHolder", I can do all the simple add/subtract math I want to it just like any normal variable as long as the values remain between 0 and 64,000andwhatever.
Right? :-)
Bookmarks