28.4.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 28.3.2.3 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 PIE3 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 TXxREG will transfer to TSR and the TXxIF flag will be set, waking the processor from Sleep. At this point, 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 at address 0x0004 will be called.