Hi,
I have a PIC program using TMR0 and need to calculate and set the TIMER LOOP to be 20MS.
The clock speed is 4MHz.
Can anyone help me set it please?
Thanks,
Camerart.
Yup!!! Is this for "Ye Olde pic18f4431" per chance??
The 4mHz will give 1uS clocks... You need to count to 20,000.. presetting TMR0L and TMR0H with 0xB1DF and set T0CON with 0x88.. ( timer on.. 16 bit.. prescaler off.. ) you need to preset each interrupt..
If you only have the 8 bit timer, then you'll need the prescaler.. A prescaler of 128 and a preset of 99 will do the job..
T0CON = 0x86.. TMRO = 0x63..
Yup!!! Is this for "Ye Olde pic18f4431" per chance??
The 4mHz will give 1uS clocks... You need to count to 20,000.. presetting TMR0L and TMR0H with 0xB1DF and set T0CON with 0x88.. ( timer on.. 16 bit.. prescaler off.. ) you need to preset each interrupt..
If you only have the 8 bit timer, then you'll need the prescaler.. A prescaler of 128 and a preset of 99 will do the job..
T0CON = 0x86.. TMRO = 0x63..