![Sino Wealth SH79F3283 Скачать руководство пользователя страница 97](http://html1.mh-extra.com/html/sino-wealth/sh79f3283/sh79f3283_manual_1283063097.webp)
SH79F3283
97
8.5.3 EUART1
The control and operate mode of EUART1 is similar to EUART0, the different is EUART1 has a baud rate generator is an
15-bit up-counting timer.
Otherwise, the baud rate generator of EURART1 has baud rate fine adjustment function by set BFINE register.
15-bit timer
To
EUART1
Overflow
Fsys
From 7FFFH to
0000H
SBRTH[14:8], SBRTL7:0]
Baudrate Generator for EUART
SBRTEN=1
SBRT
32768
Fsys
owrate
SBRToverfl
−
=
,
]
,
[
SBRTL
SBRTH
SBRT
=
So that, the baud rate computational formula of EUART1 in different modes as shown below.
Mode0:
In Mode0, the baud rate is programmable to either 1/12 or 1/4 of the system frequency. This baud rate is determined by SM2
bit. When set to 0, the serial port runs at 1/12 of the system clock. When set to 1, the serial port runs at 1/4 of the system clock.
Mode1 and Mode3:
In Mode1 & Mode3, the baud rate can be fine adjusted.
The Mode1 & 3 baud rate equations are shown below,
(
)
BFINE
SBRT
F
BaudRate
+
×
=
-
32768
16
sys
For example: Fsys = 8MHz, to get 115200Hz baud rate, computing method of SBRT and SFINE as shown below:
8000000/16/115200 = 4.34
SBRT = 32768 - 4 = 32764
115200 = 8000000/(16 X 4 + BFINE)
BFINE = 5.4
≈
5
This fine tuning method to calculate the actual baud rate is 115942Hz and the error is 0.64%, but the error is 8.5% In the past
computing method.
Mode2:
In Mode2, the baud rate is programmable to either 1/32 or 1/64 of the system clock. This baud rate is determined by the
SMOD bit (PCON.7). When this bit is set to 0, the serial port runs at 1/64 of the clock. When set to 1, the serial port runs at
1/32 of the clock.
)
64
(
2
SYS
SMOD
F
BaudRate
×
=
Note: TF3 cleared by hardware, and the interrupt vector address is as the same as Uart1. Please pay attention to the interrupt
flag, when use both Timer3 and Uart1.