30.5.2 Synchronous Transmit During Sleep
To transmit during Sleep, all the following conditions must be met before entering Sleep mode:
- The RCxSTA and TXxSTA Control registers must be configured for synchronous client transmission (see Synchronous Client Transmission Setup).
- The TXxIF interrupt flag must be cleared by writing the output data to the TXxREG, thereby filling the TSR and transmit buffer.
- The TXxIE interrupt enable bits of the PIEx register and PEIE of
the INTCON register must be written to ‘
1
’. - If interrupts are desired, set the GIE bit of the INTCON register.
Upon entering Sleep mode, the device will be ready to accept clocks on the TXx/CKx pin and transmit data on the RXx/DTx pin. When the data word in the TSR register has been completely clocked out by the external device, the pending byte in the TXxREG will transfer to the TSR and the TXxIF flag will be set. Thereby, waking the processor from Sleep. At this point, the TXxREG is available to accept another character for transmission. Writing TXxREG will clear the TXxIF flag.
Upon waking from Sleep, the instruction following the SLEEP
instruction will be executed. If the Global
Interrupt Enable (GIE) bit is also set then the Interrupt Service Routine (ISR) will be
called.