Largely simplified block schematic to demonstrate where the 'Timer 0' ('TMR0') is located in the PIC 16F1937 Architecture:
TMR0:
- This timer interrupt is used to provide the PICmicro with exact timing info.
- It is clocked by the system clock or by an external clock on RA4.
- This system clock runs exactly 4 times slower than the external oscillator clock.
- Either the external clock or the system clock can be divided by 1, 2, 4 or 8, 16, 32, 64, 128, or by 256 by configuring the Prescaler of TMR0 in Flowcode.
- This divided clock triggers TMR0 to increment the TMR0 register.
- This TMR0 register is an 8-bit register and will have an overflow when it reaches 256.
- On the exact moment when this overflow occurs, TMR0 generates an interrupt and the TMR0 register is set back to 0.
- This TMR0 Interrupt will stop the main program immediately and start up the TMR0 Macro.
- After the TMR0 Macro is finished, the main program goes further where it had left before.
Example:
External clock oscillator | = XTAL | : 19 660 800 Hz |
System Clock | = /4 | : 4 915 200 Hz |
Set prescaler to 256 | = /256 | : 19 200 Hz |
Overflow when TMR1 = 256 | = /256 | : 75 Hz |
Conclusion: In this situation, TMR0 will interrupt the main program and execute the TMR0 macro 75 times per second.