jakeselectronics
Member
I've never used any timers and am about to try.
The idea:
Im using an LCD for a system, the details of the system are of no importance.
On power up I have the title of the system on the LCD.
after 2 seconds, I want to clear the screen.
I also have a keypad that I wish to scan.
Instead of writing characters to the display, execting a delay of 2 seconds, then clearing the screen; can i use a timer to interrupt the program and clear the screen.
this way i dont miss out on anytime scaning the keypad.
I am using a PIC16F72 which has Timer0 Timer 1 and Timer2.
With Timer1
If I set the Pre-Scaler to 1:8 does this mean the timer will increment every 8 cycles?
So its a 16bit timer, therefore it will count up to 65536.
For a for a delay of .5 seconds I will need to use 500,000 cycles (at 4MHz).
If I load the timer register with D'3036', It has to count 62500 cycles to reach 65536 for an overflow.
At a 1:8 pre-scaler (62500 x 8) I will get an overflow/interrupt every 500,000 cycles
which will give me an interurrpt every half second.
then I can count to 4 to get 2 seconds. or close to.
Am I On The Right Track?
Or Way Off??????
The idea:
Im using an LCD for a system, the details of the system are of no importance.
On power up I have the title of the system on the LCD.
after 2 seconds, I want to clear the screen.
I also have a keypad that I wish to scan.
Instead of writing characters to the display, execting a delay of 2 seconds, then clearing the screen; can i use a timer to interrupt the program and clear the screen.
this way i dont miss out on anytime scaning the keypad.
I am using a PIC16F72 which has Timer0 Timer 1 and Timer2.
With Timer1
If I set the Pre-Scaler to 1:8 does this mean the timer will increment every 8 cycles?
So its a 16bit timer, therefore it will count up to 65536.
For a for a delay of .5 seconds I will need to use 500,000 cycles (at 4MHz).
If I load the timer register with D'3036', It has to count 62500 cycles to reach 65536 for an overflow.
At a 1:8 pre-scaler (62500 x 8) I will get an overflow/interrupt every 500,000 cycles
which will give me an interurrpt every half second.
then I can count to 4 to get 2 seconds. or close to.
Am I On The Right Track?
Or Way Off??????
Last edited: