19 UNIVERSAL SERIAL INTERFACE WITH LCD INTERFACE (USIL)
19-16
Seiko Epson Corporation
S1C33L26 TECHNICAL MANUAL
The transfer direction bit indicates the data transfer direction after the slave address has been sent. Set this
bit to 0 when sending data from the master to the slave.
To send a slave address, set the address with the transfer direction bit to the transmit data buffer (TD[7:0]/
USIL_TD register). Then set IMTGMOD[2:0] to 0x2 and write 1 to IMTG.
To send a 10-bit address, execute this procedure twice or three times as shown in Figure 19.5.3.4.
Writing 1 to IMTG sets IMBSY to 1. When data in the transmit data buffer is sent to the transmit shift reg-
ister, IMBSY reverts to 0 and IMSTA[2:0] is set to 0x2. Confirm that the slave address (each byte) has been
sent by reading IMBSY or using an interrupt.
After a slave address has been sent, the selected slave device sends back an ACK by pulling down the SCL
line to low. If the SCL line maintains high, it is regarded as a NAK. In this case, the I
2
C controller cannot
communicate with the slave device specified.
SDA (USIL_DI) (output)
SDA (USIL_DI) (input)
SCL (USIL_CK)
Start condition
1
2
8
9
D7
D6
D0
ACK
NAK
5.3.5 ACK and NAK
Figure 19.
It is necessary to check that an ACK has been received before sending data. To do this, set IMTGMOD[2:0]
to 0x6 and write 1 to IMTG after the slave address has been sent.
IMBSY is set to 1 while an ACK/NAK is being detected and it reverts to 0 when the detection has com-
pleted. Receiving an ACK sets IMSTA[2:0] to 0x5; receiving a NAK sets it to 0x6. Check IMSTA[2:0]
after confirming IMBSY or using an interrupt. When an ACK has been received, perform data transmission.
When a NAK has been received, perform an error handling.
(3) Data transmission
The data transmission procedure is the same as that of the slave address transmission.
1. Write an 8-bit transmit data to the transmit data buffer (TD[7:0]).
2. Set IMTGMOD[2:0] to 0x2 and IMTG to 1.
This trigger transfers the buffer data to the transmit shift register to start transmission. The module starts
clock output from the USIL_CK pin. The data in the shift register is shifted in sequence with the clock and
sent from the USIL_DO pin.
Writing 1 to IMTG sets IMBSY to 1. When data in the transmit data buffer is sent to the transmit shift reg-
ister, IMBSY reverts to 0 and IMSTA[2:0] is set to 0x2 (end of transmit data). An interrupt request can be
generated at this point. Write subsequent data to the transmit data buffer to start the following transmission
using this interrupt.
However, as in the case of the slave address transmission, check that the slave device has sent back an ACK
(by setting IMTGMOD[2:0] to 0x6 and IMTG to 1) before starting the following 8-bit data transmission.
Repeat an 8-bit data transmission and ACK receiving check for the required number of times.
(4) Generating stop condition
To end I
2
C communication after all data has been sent, the I
2
C master must generate a stop condition. The
stop condition applies when the SCL line is maintained at high and the SDA line is pulled up from low to
high. To generate a stop condition in this I
2
C master, set IMTGMOD[2:0] to 0x1 and write 1 to IMTG.
Stop condition
SDA (USIL_DI)
SCL (USIL_CK)
5.3.6 Stop Condition
Figure 19.