
Rev. 1.20
144
November 20, 2019
Rev. 1.20
145
November 20, 2019
HT66F2740
12V High Current Flash MCU
HT66F2740
12V High Current Flash MCU
gives an actual or calculated baud rate value of BR=4000000/[64×(12+1)]=4808
Therefore the error is equal to (4808 - 4800)/4800=0.16%
UART Setup and Control
For data transfer, the UART function utilizes a non-return-to-zero, more commonly known as NRZ,
format. This is composed of one start bit, eight or nine data bits, and one or two stop bits. Parity
is supported by the UART hardware, and can be setup to be even, odd or no parity. For the most
common data format, 8 data bits along with no parity and one stop bit, denoted as 8, N, 1, is used
as the default setting, which is the setting at power-on. The number of data bits and stop bits, along
with the parity, are setup by programming the corresponding UBNO, UPRT, UPREN, and USTOPS
bits in the UUCR1 register. The baud rate used to transmit and receive data is setup using the
internal 8-bit baud rate generator, while the data is transmitted and received LSB first. Although the
UART transmitter and receiver are functionally independent, they both use the same data format and
baud rate. In all cases stop bits will be used for data transmission.
Enabling/Disabling the UART Interface
The basic on/off function of the internal UART function is controlled using the UREN bit in the
UUCR1 register. When the UART mode is selected by setting the UMD bit in the SIMC0 register to
“1”, if the UREN, UTXEN and URXEN bits are set, then these two UART pins will act as normal
TX output pin and RX input pin respectively. If no data is being transmitted on the TX pin, then it
will default to a logic high value.
Clearing the UREN bit will disable the TX and RX pins and allow these two pins to be used as
normal I/O or other pin-shared functional pins by configuring the corresponding pin-shared control
bits. When the UART function is disabled the buffer will be reset to an empty condition, at the
same time discarding any remaining residual data. Disabling the UART will also reset the error and
status flags with bits UTXEN, URXEN, UTXBRK, URXIF, UOERR, UFERR, UPERR and UNF
being cleared while bits UTIDLE, UTXIF and URIDLE will be set. The remaining control bits in
the UUCR1, UUCR2 and UBRG registers will remain unaffected. If the UREN bit in the UUCR1
register is cleared while the UART is active, then all pending transmissions and receptions will be
immediately suspended and the UART will be reset to a condition as defined above. If the UART is
then subsequently re-enabled, it will restart again in the same configuration.
Data, Parity and Stop Bit Selection
The format of the data to be transferred is composed of various factors such as data bit length, parity
on/off, parity type, address bits and the number of stop bits. These factors are determined by the
setup of various bits within the UUCR1 register. The UBNO bit controls the number of data bits
which can be set to either 8 or 9, the UPRT bit controls the choice of odd or even parity, the UPREN
bit controls the parity on/off function and the USTOPS bit decides whether one or two stop bits are
to be used. The following table shows various formats for data transmission. The address bit, which
is the MSB of the data byte, identifies the frame as an address character or data if the address detect
function is enabled. The number of stop bits, which can be either one or two, is independent of the
data length and is only used for the transmitter. There is only one stop bit for the receiver.