Timer1 Interrupt

Timer1 can trigger an interrupt when it overflows from FFFFh to 0000h. When Timer1 rolls over, the Timer1 interrupt flag (TMR1IF) bit of the Peripheral Interrupt 1 Register (PIR1) is set. Timer1 overflow can be monitored by randomly checking the TMR1IF bit.

An automatic interrupt can be enabled to redirect operation to the Interrupt Service Routine as soon as Timer1 overflows. To enable the automatic interrupt on rollover, you must set these bits:

  • TMR1ON bit of the T1CON register
  • TMR1IE bit of the PIE1 register
  • PEIE bit of the INTCON register
  • GIE bit of the INTCON register

Note: For more information on the Interrupt Structure for 8-Bit Devices refer to this training module: Enhanced Mid-Range Interrrupts

The interrupt is cleared by clearing the TMR1IF bit in the Interrupt Service Routine.

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.