Timer1 Sleep Operation

Timer1 can only operate during Sleep when set up in Asynchronous mode. In this mode, an external crystal or clock source can be used to increment the counter. To set up the timer to wake the device:

  • Set the TMR1ON bit of the T1CON register
  • Set the TMR1IE bit of the PIE1 register
  • Set the PEIE bit of the INTCON register
  • Set the T1SYNC bit of the T1CON register
  • Configure the TMR1CS bits of the T1CON register
  • Configure the T1OSCEN bit of the T1CON register

The device will wake-up on a Timer1 overflow and execute the instructions following the SLEEP assembly command.

The wake up from Sleep can also drive the device to execute the Interrupt Service Routine instead of the instruction following the sleep command. To enable this, the Global Interrupt Enable (GIE) bit of the INTCON register needs to be set. The device will call the Interrupt Service Routine on wake-up. If the interrupt service routine contains a SLEEP instruction, the device will return to sleep mode. The service routine must also clear the TMR1IF prior to returning to Sleep.

© 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.