USART Operation: UART Mode
14-10 USART Peripheral Interface, UART Mode
14.2.5 USART Transmit Enable
When UTXEx is set, the UART transmitter is enabled. Transmission is initiated
by writing data to UxTXBUF. The data is then moved to the transmit shift
register on the next BITCLK after the TX shift register is empty, and
transmission begins. This process is shown in Figure 14−6.
When the UTXEx bit is reset the transmitter is stopped. Any data moved to
UxTXBUF and any active transmission of data currently in the transmit shift
register prior to clearing UTXEx will continue until all data transmission is
completed.
Figure 14−6. State Diagram of Transmitter Enable
Idle State
(Transmitter
Enabled)
Transmit
Disable
Transmission
Active
UTXEx = 0
No Data Written
to Transmit Buffer
Not Completed
UTXEx = 1
UTXEx = 0
UTXEx = 1
Data Written to
Transmit Buffer
Handle Interrupt
Conditions
Character
Transmitted
UTXEx = 1
UTXEx = 0 And Last Buffer Entry Is Transmitted
When the transmitter is enabled (UTXEx = 1), data should not be written to
UxTXBUF unless it is ready for new data indicated by UTXIFGx = 1. Violation
can result in an erroneous transmission if data in UxTXBUF is modified as it
is being moved into the TX shift register.
It is recommended that the transmitter be disabled (UTXEx = 0) only after any
active transmission is complete. This is indicated by a set transmitter empty
bit (TXEPT = 1). Any data written to UxTXBUF while the transmitter is disabled
will be held in the buffer but will not be moved to the transmit shift register or
transmitted. Once UTXEx is set, the data in the transmit buffer is immediately
loaded into the transmit shift register and character transmission resumes.