
Rev. 1.20
146
November 20, 2019
Rev. 1.20
147
November 20, 2019
HT66F2740
12V High Current Flash MCU
HT66F2740
12V High Current Flash MCU
Start Bit
Data Bits
Address Bit
Parity Bit
Stop Bit
Example of 8-bit Data Formats
1
8
0
0
1
1
7
0
1
1
1
7
1
0
1
Example of 9-bit Data Formats
1
9
0
0
1
1
8
0
1
1
1
8
1
0
1
Transmitter Receiver Data FormatThe following diagram shows the transmit and receive waveforms
for both 8-bit and 9-bit data formats.
Bit 0
8-bit data format
Bit 1
Stop
Bit
Next
Start
Bit
Start
Bit
Parity Bit
Bit 2
Bit 3
Bit 4
Bit 5
Bit 6
Bit 7
Bit 0
9-bit data format
Bit 1
Start
Bit
Bit 2
Bit 3
Bit 4
Bit 5
Bit 6
Stop
Bit
Next
Start
Bit
Parity Bit
Bit 8
Bit 7
UART Transmitter
Data word lengths of either 8 or 9 bits can be selected by programming the UBNO bit in the UUCR1
register. When UBNO bit is set, the word length will be set to 9 bits. In this case the 9th bit, which
is the MSB, needs to be stored in the UTX8 bit in the UUCR1 register. At the transmitter core lies
the Transmitter Shift Register, more commonly known as the TSR, whose data is obtained from the
transmit data register, which is known as the UTXR_RXR register. The data to be transmitted is
loaded into this UTXR_RXR register by the application program. The TSR register is not written
to with new data until the stop bit from the previous transmission has been sent out. As soon as this
stop bit has been transmitted, the TSR can then be loaded with new data from the UTXR_RXR
register, if it is available. It should be noted that the TSR register, unlike many other registers, is not
directly mapped into the Data Memory area and as such is not available to the application program
for direct read/write operations. An actual transmission of data will normally be enabled when the
UTXEN bit is set, but the data will not be transmitted until the UTXR_RXR register has been loaded
with data and the baud rate generator has defined a shift clock source. However, the transmission
can also be initiated by first loading data into the UTXR_RXR register, after which the UTXEN bit
can be set. When a transmission of data begins, the TSR is normally empty, in which case a transfer
to the UTXR_RXR register will result in an immediate transfer to the TSR. If during a transmission
the UTXEN bit is cleared, the transmission will immediately cease and the transmitter will be reset.
The TX output pin can then be configured as the I/O or other pin-shared function by configuring the
corresponding pin-shared control bits.
Transmitting Data
When the UART is transmitting data, the data is shifted on the TX pin from the shift register, with
the least significant bit first. In the transmit mode, the UTXR_RXR register forms a buffer between
the internal bus and the transmitter shift register. It should be noted that if 9-bit data format has been
selected, then the MSB will be taken from the UTX8 bit in the UUCR1 register. The steps to initiate
a data transfer can be summarized as follows:
•
Make the correct selection of the UBNO, UPRT, UPREN and USTOPS bits to define the required
word length, parity type and number of stop bits.