Largely simplified block schematic to demonstrate where the 'Timer 1' ('TMR1') is located in the PIC 16F1937 Architecture:
TMR1:
- 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 RC0.
- Either the external clock or the system clock can be divided by 1, 2, 4 or 8 by configuring the Prescaler of TMR1 in Flowcode.
- This divided clock triggers the TMR1 to increment the TMR1 register.
- This TMR1 register is a 16-bit register and will have an overflow when it reaches 65536.
- On the exact moment when this overflow occurs, TMR1 generates an interrupt and the TMR1 register is set back to 0.
- This TMR1 Interrupt will stop the main program immediately and start up the TMR1 Macro.
- After the TMR1 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 8 | = /8 | : 614 400 Hz |
Overflow when TMR1 = 256 | = /256 | : 2400 Hz |
Conclusion: In this situation, TMR1 will interrupt the main program and execute the TMR1 Macro 2400 times per second.