12 UART (UART3)
12-4
Seiko Epson Corporation
S1C17M20/M21/M22/M23/M24/M25
TECHNICAL MANUAL (Rev. 1.0)
UAnMOD register
PREN bit
0
1
0
1
0
1
0
1
STPB bit
0
0
1
1
0
0
1
1
CHLN bit
0
0
0
0
1
1
1
1
st: start bit, sp: stop bit, p: parity bit
st
D0
D1
D2
D3
D4
D5
D6
sp
st
D0
D1
D2
D3
D4
D5
D6
p
sp
st
D0
D1
D2
D3
D4
D5
D6
sp
sp
st
D0
D1
D2
D3
D4
D5
D6
p
sp
sp
st
D0
D1
D2
D3
D4
D5
D6
D7
sp
st
D0
D1
D2
D3
D4
D5
D6
D7
p
sp
st
D0
D1
D2
D3
D4
D5
D6
D7
sp
sp
st
D0
D1
D2
D3
D4
D5
D6
D7
p
sp
sp
Figure 12.4.1 Data Format
12.5 Operations
12.5.1 Initialization
The UART3 Ch.
n
should be initialized with the procedure shown below.
1. Assign the UART3 Ch.
n
input/output function to the ports. (Refer to the “I/O Ports” chapter.)
2. Set the UA
n
CLK.CLKSRC[1:0] and UA
n
CLK.CLKDIV[1:0] bits. (Configure operating clock)
3. Configure the following UA
n
MOD register bits:
- UA
n
MOD.BRDIV bit (Select baud rate division ratio (1/16 or 1/4))
- UAnMOD.INVRX bit (Enable/disable USIN
n
input signal inversion)
- UAnMOD.INVTX bit (Enable/disable USOUT
n
output signal inversion)
- UA
n
MOD.PUEN bit
(Enable/disable USIN
n
pin pull-up)
- UA
n
MOD.OUTMD bit (Enable/disable USOUT
n
pin open-drain output)
- UA
n
MOD.IRMD bit
(Enable/disable IrDA interface)
- UA
n
MOD.CHLN bit
(Set data length (7 or 8 bits))
- UA
n
MOD.PREN bit
(Enable/disable parity function)
- UA
n
MOD.PRMD bit
(Select parity mode (even or odd))
- UA
n
MOD.STPB bit
(Set stop bit length (1 or 2 bits))
- UA
n
MOD.CAREN bit (Enable/disable carrier modulation function)
- UAnMOD.PECAR bit (Select carrier modulation period (H data period/L data period))
4. Set the UA
n
BR.BRT[7:0] and UA
n
BR.FMD[3:0] bits.
(Set transfer rate)
5. Set the UA
n
CAWF.CRPER[7:0] bits.
(Set carrier cycle)
6. Set the following UA
n
CTL register bits:
- Set the UA
n
CTL.SFTRST bit to 1.
(Execute software reset)
- Set the UA
n
CTL.MODEN bit to 1.
(Enable UART3 Ch.
n
operations)
7. Set the following bits when using the interrupt:
- Write 1 to the interrupt flags in the UA
n
INTF register.
(Clear interrupt flags)
- Set the interrupt enable bits in the UA
n
INTE register to 1. * (Enable interrupts)
*
The initial value of the UA
n
INTF.TBEIF bit is 1, therefore, an interrupt will occur immediately after the UA-
n
INTE.TBEIE bit is set to 1.