Synchronous Master Transmission Setup

  1. 1.Initialize the SPxBRGH, SPxBRGL register pair and the BRG16 bit to achieve the desired baud rate (see EUSART Baud Rate Generator (BRG)).
  2. 2.Select the transmit output pin by writing the appropriate values to the RxyPPS register and RXxPPS register. Both selections should enable the same pin.
  3. 3.Select the clock output pin by writing the appropriate values to the RxyPPS register and CKxPPS register. Both selections should enable the same pin.
  4. 4.Enable the synchronous master serial port by setting bits SYNC, SPEN and CSRC.
  5. 5.Disable Receive mode by clearing bits SREN and CREN.
  6. 6.Enable Transmit mode by setting the TXEN bit.
  7. 7.If 9-bit transmission is desired, set the TX9 bit.
  8. 8.If interrupts are desired, set the TXxIE bit of the PIEx register and the GIE and PEIE bits of the INTCON register.
  9. 9.If 9-bit transmission is selected, the ninth bit should be loaded in the TX9D bit.
  10. 10.Start transmission by loading data to the TXxREG register.
Figure 1. Synchronous Transmission