Datasheet

CHAPTER 13 SERIAL INTERFACE UART0
User’s Manual U18698EJ1V0UD
324
13.4.2 Asynchronous serial interface (UART) mode
In this mode, 1-byte data is transmitted/received following a start bit, and a full-duplex operation can be performed.
A dedicated UART baud rate generator is incorporated, so that communication can be executed at a wide range of
baud rates.
(1) Registers used
Asynchronous serial interface operation mode register 0 (ASIM0)
Asynchronous serial interface reception error status register 0 (ASIS0)
Baud rate generator control register 0 (BRGC0)
Port mode register 1 (PM1)
Port register 1 (P1)
The basic procedure of setting an operation in the UART mode is as follows.
<1> Set the BRGC0 register (see Figure 13-4).
<2> Set bits 1 to 4 (SL0, CL0, PS00, and PS01) of the ASIM0 register (see Figure 13-2).
<3> Set bit 7 (POWER0) of the ASIM0 register to 1.
<4> Set bit 6 (TXE0) of the ASIM0 register to 1. Transmission is enabled.
Set bit 5 (RXE0) of the ASIM0 register to 1. Reception is enabled.
<5> Write data to the TXS0 register. Data transmission is started.
Caution Take relationship with the other party of communication when setting the port mode register
and port register.
The relationship between the register settings and pins is shown below.
Table 13-2. Relationship Between Register Settings and Pins
Pin Function POWER0 TXE0 RXE0 PM13 P13 PM12 P12
UART0
Operation
TxD0/KR4/P13/<TxD6> RxD0/KR3/P12/<RxD6>
0 0 0 ×
Note
×
Note
×
Note
×
Note
Stop KR4/P13/<TxD6> KR3/P12/<RxD6>
0 1 ×
Note
×
Note
1
×
Reception KR4/P13 RxD0
1 0 0
×
×
Note
×
Note
Transmission TxD0 KR3/P12
1
1 1 0
×
1
×
Transmission/
reception
TxD0 RxD0
Note Can be set as port function, key interrupt, or serial interface UART6 (only when UART0 is stopped).
Remarks 1. ×: don’t care
POWER0: Bit 7 of asynchronous serial interface operation mode register 0 (ASIM0)
TXE0: Bit 6 of ASIM0
RXE0: Bit 5 of ASIM0
PM1×: Port mode register
P1×: Port output latch
2. The functions within arrowheads (< >) can be assigned by setting the input switch control register
(ISC).