ML51/ML54/ML56
Sep. 01, 2020
Page
480
of 719
Rev 2.00
ML
51
/ML
54
/ML
5
6 S
E
RI
E
S
TECHNI
CA
L
RE
F
E
R
E
NC
E
M
A
NU
A
L
ML51/M
L54
/M
L56
Series
Tec
hnical Reference
Manual
Mode
SM0_1 / SM1_1
(S1CON[7:6])
SMOD_1
(T3CON[7])
Frame Bits
Baud Rate
0
00
-
8
F
SYS
divided by 12
1
01
0
10
Timer 3
RL3)
RH3
(256
-
65536
scale
-
Pre
F
32
1
SYS
1
Timer 3
RL3)
RH3
(256
-
65536
scale
-
Pre
F
16
1
SYS
2
10
0
11
F
SYS
divided by 64
1
F
SYS
divided by 32
3
11
0
11
Timer 3
RL3)
RH3
(256
-
65536
scale
-
Pre
F
32
1
SYS
1
Timer 3
RL3)
RH3
(256
-
65536
scale
-
Pre
F
16
1
SYS
Table 6.9-2 Serial Port 1 Mode / baud rate Description
Sample code: we list the most popular UART setting Mode 1 initial step as following
:
Serial port 0 (
UART0
) use
timer 1
as baudrate generator: Formula is
TH1
-
256
F
16
1
SYS
SCON = 0x50;
//UART0 Mode1,REN=1,TI=1
TMOD |= 0x20;
//Timer1 set to Mode2 auto reload mode (must)
PCON |= 0x80;
//UART0 Double Rate Enable
CKCON |= 0x10;
//Timer 1 as clock source
T3CON &= 0xDF;
//Timer1 as UART0 clock source
TH1 =
value
;
TR1=1;
Serial port 0 (
UART0
) use
timer 3
as baudrate generator: Formula is
RL3)
RH3
(256
-
65536
scale
-
Pre
F
16
1
SYS
SCON = 0x50;
//UART0 Mode1,REN=1,TI=1
PCON |= 0x80;
//UART0 Double Rate Enable
T3CON &= 0xF8;
//(Prescale=1)
T3CON |= 0x20;
//UART0 baud rate clock source = Timer3
RH3 =
value high byte