28.3.1.4 Synchronous Host Transmission Setup
- Initialize the SPxBRGH, SPxBRGL register pair and the BRG16 bit to achieve the desired baud rate (see 28.2 EUSART Baud Rate Generator (BRG)).
- Select the transmit output pin by writing the appropriate values to the RxyPPS and RXxPPS registers. Both selections may enable the same pin.
- Select the clock output pin by writing the appropriate values to the RxyPPS and CKxPPS registers. Both selections may enable the same pin.
- Enable the synchronous host serial port by setting bits SYNC, SPEN and CSRC.
- Disable Receive mode by clearing the SREN and CREN bits.
- Enable Transmit mode by setting the TXEN bit.
- If 9-bit transmission is desired, set the TX9 bit.
- If interrupts are desired, set the TXxIE bit of the PIE3 register and the GIE and PEIE bits of the INTCON register.
- If 9-bit transmission is selected, the ninth bit may be loaded in the TX9D bit.
- Start transmission by loading data to the TXxREG register.