In: Electrical Engineering
For PIC16F1619, how does the TIMER0 prescalar work? If we set PS2 = 0, PS1 = 0, and PS0 = 1 in the OPTION_REG register, how often does TIMER0 generate an interrupt?
Following is the block diagram of TIMER0
In above diagram we can see that prescalar can be sourced by two clock sources
1) FOSC/4
2) T0CKI pin
Table for prescalar value and PS[2:0] bits.
PS[2:0] | Prescalar |
000 | 2 |
001 | 4 |
010 | 8 |
011 | 16 |
100 | 32 |
101 | 64 |
110 | 128 |
111 | 256 |
given that
PS[2:0]=001
So from table prescalar value is 4.
Now Prescalar output frequency will depend on input frequency
Now say fosc=16MHz and Prescalar is 4
Interrupt can either be generated by INT pin or timer overflow.
Timer overflow interrupt is generated when overflow occurs on timer.
Timer overflow Interrupt enabled by setting up INTCON Register (if required set it up).
Time delay for timer overflow interrupt can be calculated as follows
for 16Mhz frequency and 001 PS[2:0] bits.