View previous topic :: View next topic |
Author |
Message |
BrianC
Joined: 23 Apr 2022 Posts: 11 Location: UK
|
PIC1826K42 T0 |
Posted: Mon May 02, 2022 3:06 am |
|
|
Hi,
Having a little problem with Timer_0,
If I set it up as
Code: | setup_timer_0(T0_INTERNAL | T0_DIV_1024 | T0_8_BIT); |
and enabled the interrupt and it works fine, however if i change it to
Code: | setup_timer_0(T0_INTERNAL | T0_DIV_256 | T0_16_BIT); |
so I can fine tune the timing with the reload value then it stops working.
It compiles OK, and the .h file for the chip and the data sheet allow it.
Have I missed something ?????
Regards
Brian |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9168 Location: Greensville,Ontario
|
|
Posted: Mon May 02, 2022 5:10 am |
|
|
really need to see a small program that this happens to.
One thing I think is that the variable that you're using to fill the reload value is still 8 bits and not 16 ??
Others who use that PIC may know |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19358
|
|
Posted: Mon May 02, 2022 7:08 am |
|
|
There are fundamental difference to how T0 operates in 8 bit versus 16 bit
modes. In 8 bit, the interrupt is set when the TMR0L value matches the
TMR0H register value. In 16bit it is only set when the timer rolls over.
As Jay says, you need to show us what you are actually doing. Also
say what compiler version. |
|
![](templates/subSilver/images/spacer.gif) |
|