33.1.1.7 Asynchronous Transmission Setup
- Initialize the SPxBRGH:SPxBRGL register pair and the BRGH and BRG16 bits to achieve the desired baud rate (see EUSART Baud Rate Generator (BRG)).
- Select the transmit output pin by writing the appropriate value to the RxyPPS register.
- Enable the asynchronous serial port by clearing the SYNC bit and setting the SPEN bit.
- If 9-bit transmission is desired, set the TX9 control bit. That will indicate that the eight Least Significant data bits are an address when the receiver is set for address detection.
- Set SCKP bit if inverted transmit is desired.
- Enable the transmission by setting the TXEN control bit. This will cause the TXxIF interrupt bit to be set.
- If interrupts are desired, set the TXxIE interrupt enable bit of the PIEx register.
- An interrupt will occur immediately provided that the GIE and PEIE bits of the INTCON register are also set.
- If 9-bit transmission is selected, the ninth bit will be loaded into the TX9D data bit.
- Load 8-bit data into the TXxREG register. This will start the transmission.