Hello Guru's,
Just trying to appreciate exactly how to use TMR3.
I wrote this basic CODE in order to understand the timer. It appears to function as I expected in the PE6 simulator. TIMER3 increments, C.1 and C.2 go HIGH accordingly. But when running on a LIVE 20X2 chip the TIMER3 value remains at ZERO and therefore C.1 and C.2 remain LOW.
I have a DSO connected to C.1 and C.2 set to trigger on the rising edge of C.1 ready to see the result.
From my CODE, I am expecting at the 250uS mark C.1 will go HIGH and then 250uS later C.2 will go HIGH. I realize there will be slight discrepancies due to program CODE execution time, however this unimportant.
Also I am expecting TIMER3 to increment +1 every 1uS (32MHz clock with 1:8 prescale set). Am I understanding the setup correctly here?
Also running this CODE at 64MHz with 'SETFREQ M64' in PE simulator, the Timer3 value remains at 1 and does not increment.
Where am I going wrong?
Thanks in advance.
Regards,
Mort.
Just trying to appreciate exactly how to use TMR3.
I wrote this basic CODE in order to understand the timer. It appears to function as I expected in the PE6 simulator. TIMER3 increments, C.1 and C.2 go HIGH accordingly. But when running on a LIVE 20X2 chip the TIMER3 value remains at ZERO and therefore C.1 and C.2 remain LOW.
I have a DSO connected to C.1 and C.2 set to trigger on the rising edge of C.1 ready to see the result.
From my CODE, I am expecting at the 250uS mark C.1 will go HIGH and then 250uS later C.2 will go HIGH. I realize there will be slight discrepancies due to program CODE execution time, however this unimportant.
Also I am expecting TIMER3 to increment +1 every 1uS (32MHz clock with 1:8 prescale set). Am I understanding the setup correctly here?
Code:
setfreq m32
tmr3setup %00110011 ' timer3 on, 1:8 prescale
low c.1
low c.2
main:
sertxd("Timer3: ",#timer3,cr)
if timer3 > 250 then
high c.1
endif
if timer3 > 500 then
high c.2
endif
goto main
Also running this CODE at 64MHz with 'SETFREQ M64' in PE simulator, the Timer3 value remains at 1 and does not increment.
Where am I going wrong?
Thanks in advance.
Regards,
Mort.