Timer1 can only operate during Sleep when setup 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:
• TMR1ON bit of the T1CON register must be set
• TMR1IE bit of the PIE1 register must be set
• PEIE bit of the INTCON register must be set
• T1SYNC bit of the T1CON register must be set
• TMR1CS bits of the T1CON register must be configured
• T1OSCEN bit of the T1CON register must be configured
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 the execute the Interrupt Service Routine instead of the instruction following the sleep command. To enable this the Global Interrupt Enable bit (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.
Microchip Technology acquires Atmel