PDA

View Full Version : Questions on PB3 and Timers



PickyBiker
- 1st February 2013, 20:22
I have lots of question about PBP 3, Timers, and especially Timer 2. I hope someone can answer at lease some of them.

I will start with the most important two questions here.

A few programs out there allow you to select the Instruction Reload time (IRT) in the timer calculations. Very nice, if you know what the instruction reload time is when using PBP 3.

Example:
For Timer 0, you need something like this
Interrupt-routine:
INTCON.2 = 0 ' clear the int flag
TMR0 = <some value 0-255>
'<do something>
resume

For Timer 1, you need something like
T1Word var word
@T1WORD = TMR0L
Interrupt-routine:
PIR1.0 = 0 ' clear the int flag
T1WORD = <some value 0-65535>
'<do something>
resume

In some cases, you don't need to reload the starting value because rolling over to 0 works just fine for the time period you desire.

So the question is: When using PBP 3, how can I calculate the IRT when I don't know what assembly instructions PB3 generates to accomplish the reloads and resume? I looked at the list and asm files, but there is weird stuff there that I can't yet decode.

The second question is about the formula for calculating the interrupt time on Timer 2. I think I have it down for Timer 0 and Timer 1, but Timer two appears to have one less count before it interrupts. T0 & T1 count from 0 lets say to FF or FFFF respectively, and then interrupt on the overflow. While T2 appears to interrupt when it reaches FF and so has 1 less count. Am I reading that correctly?

Thanks for any help.

PickyBiker

PickyBiker
- 5th February 2013, 17:05
These questions were answered in another forum
http://support.melabs.com/threads/753-PBP3-and-Timers