View previous topic :: View next topic |
Author |
Message |
Konrad
Joined: 15 Sep 2003 Posts: 34
|
16 bit timers |
Posted: Wed Sep 22, 2004 4:00 pm |
|
|
has anyone had trouble with PIC18 16 bit timers?
my colleague has a problem which looks like a roll over from low byte to high byte of a timer. The PIC data sheet says that the timer can be treated as 16bit, the high byte being buffered. From the list file, CCS is doing everything correctly, but it seems as if there is a hardware problem.
Anyone had similar problems? |
|
|
bdavis
Joined: 31 May 2004 Posts: 86 Location: Colorado Springs, CO
|
|
Posted: Wed Sep 22, 2004 6:39 pm |
|
|
I use it without any issues...
When writing the timer, write the high value, then the low value.
When reading the timer, you need to do it in a certian order also, or use CCS's built in functions.
You could ask your friend to test it outside of any interrupt routine to simplify things (ie: polling). After that is working then try interrupts... |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Sep 22, 2004 10:06 pm |
|
|
Quote: | When reading the timer, you need to do it in a certian order also |
If memory serves me correctly, the high byte is buffered when the low byte is read.
Quote: | When writing the timer, write the high value, then the low value |
I would clear the low byte first, then write the high byte and then the low byte. This would prevent the possibility of the low byte rolling over and incrementing the high byte. |
|
|
|