- watchdog timer, used to reset the controller if a hang of system or unexpected logical conditions occur.
- 8 bit basic timer, upper limit is 255. Usually for general purpose
- 16 bit timer, upper limit is 65535, used for PWM and capture/compare function, e.g RC acquisition.
Assume that Timer1 is set up with a prescaler of 8 on a MCU clocked at 20 MHz. Assume that a total of 6250 clicks were counted.
then . . .
- delay (in ms) = (# ticks) * 4 * 8 * 1000 / (20000000)
delay (in ms) = (6250) / 625 = 10 ms
- 4: in PIC16 and 18F families 1 instruction cycle = 4 crystal cycle
- 8: prescaler number
- 1000: unit in ms
- 20000000: 20 MHz clock input
Reference:
good post! thank you
ReplyDelete