14 I
2
C (I2C)
14-10
Seiko Epson Corporation
S1C17M20/M21/M22/M23/M24/M25
TECHNICAL MANUAL (Rev. 1.0)
S
A
TXSTART = 0
STARTIF = 1
TBEIF = 1
TBEIF = 1
TXSTART = 1
1stAddr/W
→
TXD[7:0]
2ndAddr
→
TXD[7:0]
Data 1
→
TXD[7:0]
TBEIF = 1
TBEIF = 1
1stAddr/W
A
2ndAddr
A
Data 1
I
2
C bus
Standby state (SCL = low)
At start of data transmission
S
A
TXSTART = 0
STARTIF = 1
TBEIF = 1
TBEIF = 1
TXSTART = 1
Sr
TXSTART = 0
STARTIF = 1
TBEIF = 1
TXSTART = 1
1stAddr/W
→
TXD[7:0]
2ndAddr
→
TXD[7:0]
TBEIF = 1
1stAddr/W
A
1stAddr/R
→
TXD[7:0]
1stAddr/R
A
2ndAddr
I
2
C bus
Standby state (SCL = low)
At start of data reception
Software bit operations
Operations by I2C (master mode)
S: START condition, Sr: Repeated START condition, P: STOP condition,
A: ACK, A: NACK, 1stAddr/W: 1st a W(0), 1stAddr/R: 1st a R(1),
2ndAddr: 2nd address, Data n: 8-bit data
Hardware bit operations
Operations by the external slave
RBFIF = 1
A
Data 1
RXD[7:0]
→
Data 1
Data 2
RBFIF = 1
A
Figure 14.4.4.2 Example of Data Transfer Starting Operations in 10-bit Address Mode (Master Mode)
14.4.5 Data Transmission in Slave Mode
A data sending procedure in slave mode and the I2C Ch.
n
operations are shown below. Figures 14.4.5.1 and 14.4.5.2
show an operation example and a flowchart, respectively.
Data sending procedure
1. Wait for a START condition interrupt (I2C
n
INTF.STARTIF bit = 1).
Clear the I2C
n
INTF.STARTIF bit by writing 1 after the interrupt has occurred.
2. Check to see if the I2C
n
INTF.TR bit = 1 (transmission mode).
(Start a data receiving procedure if the I2C
n
INTF.TR bit = 0.)
3. Write transmit data to the I2C
n
TXD register.
4. Wait for a transmit buffer empty interrupt (I2C
n
INTF.TBEIF bit = 1), a NACK reception interrupt (I2C-
n
INTF.NACKIF bit = 1), or a STOP condition interrupt (I2C
n
INTF.STOPIF bit = 1).
i. Go to Step 3 when a transmit buffer empty interrupt has occurred.
ii. Go to Step 5 after clearing the I2C
n
INTF.NACKIF bit when a NACK reception interrupt has occurred.
iii. Go to Step 6 when a STOP condition interrupt has occurred.
5. Wait for a STOP condition interrupt (I2C
n
INTF.STOPIF bit = 1) or a START condition interrupt (I2C
n
INTF.
STARTIF bit = 1).
i. Go to Step 6 when a STOP condition interrupt has occurred.
ii. Go to Step 2 when a START condition interrupt has occurred.
6. Clear the I2C
n
INTF.STOPIF bit and then terminate data sending operations.