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 (ISR) 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 the Enhanced Mid-Range Interrrupts training module.

The interrupt is cleared by clearing the TMR1IF bit in the ISR.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
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.