Thanks in advance.
Hi, I think I have detected a few problems with the "TMR0 Adjust" feature in the PIC Timer Calculator (I think ), v0.9.0. (still present in v0.9.2)
1. If one activates this feature then the TMR0 "preload" value is decremented by 2. I think it should be incremented by 2 in stead. The reason is that 2 cycles are skipped by timer0, resulting in a longer delay to next rollover. To compensate for this the preload value should be 2 higher than normal.
Extract from the "MID Range Manual", section Timer0:and (from the "Design tips"):Any write to the TMR0 register will cause a 2 instruction cycle (2TCY) inhibit. That is, after the
TMR0 register has been written with the new value, TMR0 will not be incremented until the third
instruction cycle later (Figure 11-2).2. The correction in the "preload" value does not take into account if the prescaler is used. The correction in this preload value should be multiplied by the division caused by the prescaler (so, if the prescaler is at 1:4, then the correction should be 4 times 2 units).When writing to TMR0, two instruction clock cycles are lost. Often you have a specific time period you want to count, say 100 decimal. In that case you might put 156 into TMR0 (256 - 100 = 156). However, since two instruction cycles are lost when you write to TMR0 (for internal logic synchronization), you should actually write 158 to the timer.
Extract from the "MID Range Manual", section Timer0:By the way: GREAT TOOL!When the prescaler is assigned to the Timer0 module, any
write to the TMR0 register will immediately update the TMR0 register and clear the prescaler. The
incrementing of Timer0 (TMR0 and Prescaler) will also be inhibited 2 instruction cycles (TCY). So
if the prescaler is configured as 2, then after a write to the TMR0 register TMR0 will not increment
for 4 Timer0 clocks (Figure 11-3). After that, TMR0 will increment every prescaler number of
clocks later.