![Cmsemicon CMS80F731 Series Скачать руководство пользователя страница 197](http://html1.mh-extra.com/html/cmsemicon/cms80f731-series/cms80f731-series_reference-manual_2627610197.webp)
www
.mcu.com.cn
198
/
239
Rev.
1.00
CMS80F731x Reference Manual
22.3 UARTn Baud Rate
UARTn In mode 0, the baud rate is fixed to the twelfth-way frequency of the system clock (Fsys/12); In mode 2, the baud
rate is fixed to the system clock's division 32 or 64 (Fsys/32, Fsys/64); In modes 1 and 3, the baud rate is generated by the timer
Timer1 or Timer4 or Timer2 or BRT module, and the chip chooses which timer to use as the baud rate clock source is determined
by the register FUNCCR.
22.3.1
Baud Rate Clock Source
UARTn In mode 1 and mode 3, the baud rate clock source selection is as follows:
1) UART0 baud rate clock source selection:
FunccR [2:0] = 000, Timer1 is selected as the baud rate generator for UART0;
FunccR [2:0] = 001, Timer4 is selected as the baud rate generator for UART0;
FunccR [2:0] = 010, Select Timer2 as the baud rate generator for UART0;
FunccR [2:0] = 011, BRT is chosen as the baud rate generator for UART0.
2) UART1 baud rate clock source selection:
FunccR [6:4] = 000, Timer1 is selected as the baud rate generator for UART1;
FUNCCR[6:4]=001, Select Timer4 as the baud rate generator for UART1;
FUNCCR [6:4] = 010, Timer2 was selected as the baud rate generator for UART1;
FUNCCR [6:4] = 011, BRT was chosen as the baud rate generator for UART1.
22.3.2
Baud Rate Calculation
In mode 1 and mode 3, the baud rate calculation formula for different clock sources is as follows:
1) Timer1 or Timer4 works in 8-bit auto-reload mode with baud rate formula:
BaudRate=
Fsys×2
SMODn
32×
(
4×3
1-TxM
)
×
(
256-THx
)
(x=1,4)
SMODn is the baud rate select bit and is set by the register PCON. T1M is the timer 1 clock select bit, set by register
CKCON[4], T4M is the timer 4 clock select bit, set by register T34MOD[6]. i.e. the value of Timer1 or Timer4 at the corresponding
baud rate TH1/TH4 should be set to:
THx=256-
Fsys×2
SMODn
32×
(
4×3
1-TxM
)
×BaudRate
(x=1,4)
2) Timer2 works in the formula of baud rate in overflow auto Reload mode:
BaudRate=
Fsys×2
SMODn
32×
(
12×2
T2PS
)
×
(
65536-{RLDH,RLDL}
)
T2PS is a timer 2 clock prescaler selection bit set by register T2CON[7]. That is, the value of Timer2 at the corresponding
baud rate should be set to:{RLDH,RLDL}
{RLDH,RLDL}=65536-
Fsys×2
SMODn
32×
(
12×2
T2PS
)
×BaudRate
3) When BRT is used as a baud rate generator, the baud rate formula:
BaudRate=
Fsys×2
SMODn
32×
(
65536-{BRTDH,BRTDL}
)
×2
BRTCKDIV