Operations; Initialization; Data Transmission - Epson S1C17M01 Technical Manual

Cmos 16-bit single chip microcontroller
Table of Contents

Advertisement

11 UART (UART)
UAnMOD register
CHLN bit
STPB bit
0
0
0
0
0
1
0
1
1
0
1
0
1
1
1
1

11.5 Operations

11.5.1 Initialization

The UART Ch.n should be initialized with the procedure shown below.
1. Assign the UART Ch.n input/output function to the ports. (Refer to the "I/O Ports" chapter.)
2. Set the UAnCLK.CLKSRC[1:0] and UAnCLK.CLKDIV[1:0] bits. (Configure operating clock)
3. Configure the following UAnMOD register bits:
- UAnMOD.PUEN bit
- UAnMOD.OUTMD bit
- UAnMOD.IRMD bit
- UAnMOD.CHLN bit
- UAnMOD.PREN bit
- UAnMOD.PRMD bit
- UAnMOD.STPB bit
4. Set the UAnBR.BRT[7:0] and UAnBR.FMD[3:0] bits.
5. Set the following UAnCTL register bits:
- Set the UAnCTL.SFTRST bit to 1.
- Set the UAnCTL.MODEN bit to 1.
6. Set the following bits when using the interrupt:
- Write 1 to the interrupt flags in the UAnINTF register.
- Set the interrupt enable bits in the UAnINTE register to 1. * (Enable interrupts)
* The initial value of the UAnINTF.TBEIF bit is 1, therefore, an interrupt will occur immediately after the UA-
nINTE.TBEIE bit is set to 1.

11.5.2 Data Transmission

A data sending procedure and the UART Ch.n operations are shown below. Figures 11.5.2.1 and 11.5.2.2 show a
timing chart and a flowchart, respectively.
Data sending procedure
1. Check to see if the UAnINTF.TBEIF bit is set to 1 (transmit buffer empty).
2. Write transmit data to the UAnTXD register.
3. Wait for a UART interrupt when using the interrupt.
4. Repeat Steps 1 to 3 (or 1 and 2) until the end of transmit data.
11-4
PREN bit
0
st
D0
1
st
D0
0
st
D0
1
st
D0
0
st
D0
1
st
D0
0
st
D0
1
st
D0
Figure 11.4.1 Data Format
Seiko Epson Corporation
D1
D2
D3
D4
D5
D1
D2
D3
D4
D5
D1
D2
D3
D4
D5
D1
D2
D3
D4
D5
D1
D2
D3
D4
D5
D1
D2
D3
D4
D5
D1
D2
D3
D4
D5
D1
D2
D3
D4
D5
st: start bit, sp: stop bit, p: parity bit
(Enable/disable USINn pin pull-up)
(Enable/disable USOUTn pin open-drain output)
(Enable/disable IrDA interface)
(Set 7/8-bit data length)
(Enable/disable parity function)
(Even/odd parity selection)
(Set 1/2-bit stop bit length)
(Set transfer rate)
(Execute software reset)
(Enable UART Ch.n operations)
(Clear interrupt flags)
D6
sp
D6
p
sp
D6
sp
sp
D6
p
sp
sp
D6
D7
sp
D6
D7
p
sp
D6
D7
sp
sp
D6
D7
p
sp
sp
S1C17M01 TECHNICAL MANUAL
(Rev. 1.2)

Advertisement

Table of Contents
loading

Table of Contents