35.2.1.8 Asynchronous Transmission Setup
Use the following steps as a guide for configuring the UART for asynchronous transmissions.
- Initialize the UxBRG register pair and the BRGS bit to achieve the desired baud rate.
- Set the MODE bits to the desired Asynchronous mode.
- Set the TXPOL bit if inverted TX output is desired.
- Enable the asynchronous serial port by setting the ON bit.
- Enable the transmitter by setting the TXEN Control bit. This will cause the UxTXIF Interrupt flag to be set.
- If the device has PPS, configure the desired I/O pin RxyPPS register with the code for the TX output.
- If interrupts are desired, set the UxTXIE Interrupt Enable bit in the respective PIE register. An interrupt will occur immediately provided that global interrupts are also enabled.
- Write one byte of data into the UxTXB register. This will start the transmission.
- Subsequent bytes may be written when
the UxTXIF bit is ‘
1
’.