
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
• UTXR_RXR Register
The UTXR_RXR register is the data register which is used to store the data to be transmitted on the
TX pin or being received from the RX pin.
Bit
7
6
5
4
3
2
1
0
Name
UTXRX7 UTXRX6 UTXRX5 UTXRX4 UTXRX3 UTXRX2 UTXRX1 UTXRX0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
POR
x
x
x
x
x
x
x
x
“x”: unknown
Bit 7~0
UTXRX7~UTXRX0
: UART Transmit/Receive Data bit 7 ~ bit 0
• UBRG Register
Bit
7
6
5
4
3
2
1
0
Name
UBRG7
UBRG6
UBRG5
UBRG4
UBRG3
UBRG2
UBRG1
UBRG0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
POR
x
x
x
x
x
x
x
x
“x”: unknown
Bit 7~0
UBRG7~UBRG0
: Baud Rate values
By programming the UBRGH bit in UUCR2 Register which allows selection of the
related formula described above and programming the required value in the UBRG
register, the required baud rate can be setup.
Note: Baud rate=f
H
/[64×(N+1)] if UBRGH=0.
Baud rate=f
H
/[16×(N+1)] if UBRGH=1.
Baud Rate Generator
To setup the speed of the serial data communication, the UART function contains its own dedicated
baud rate generator. The baud rate is controlled by its own internal free running 8-bit timer, the
period of which is determined by two factors. The first of these is the value placed in the baud rate
register UBRG and the second is the value of the UBRGH bit with the control register UUCR2. The
UBRGH bit decides if the baud rate generator is to be used in a high speed mode or low speed mode,
which in turn determines the formula that is used to calculate the baud rate. The value N in the
UBRG register which is used in the following baud rate calculation formula determines the division
factor. Note that N is the decimal value placed in the UBRG register and has a range of between 0
and 255.
UUCR2 UBRGH Bit
0
1
Baud Rate (BR)
f
H
/[64 (N+1)]
f
H
/[16 (N+1)]
By programming the UBRGH bit which allows selection of the related formula and programming
the required value in the UBRG register, the required baud rate can be setup. Note that because the
actual baud rate is determined using a discrete value, N, placed in the UBRG register, there will be
an error associated between the actual and requested value. The following example shows how the
UBRG register value N and the error value can be calculated.
Calculating the Baud Rate and Error Values
For a clock frequency of 4MHz, and with UBRGH cleared to zero determine the UBRG register
value N, the actual baud rate and the error value for a desired baud rate of 4800.
From the above table the desired baud rate BR=f
H
/[64 (N+1)]
Re-arranging this equation gives N=[f
H
/(BR×64)] - 1
Giving a value for N=[4000000/(4800×64)] - 1=12.0208
To obtain the closest value, a decimal value of 12 should be placed into the UBRG register. This