13 I
2
C (I2C)
13-8
Seiko Epson Corporation
S1C17M12/M13 TECHNICAL MANUAL
(Rev. 1.2)
S
S
P
A
TXSTART = 0
STARTIF = 1
TBEIF = 1
TXSTART = 0
STARTIF = 1
TBEIF = 1
TXSTART = 0
STARTIF = 1
TBEIF = 1
NACKIF = 1
TXSTART = 1
TXSTOP = 1
RXD[7:0]
→
Data N
TXSTART = 1
RXD[7:0]
→
Data N
TXSTART = 1
TXSTOP = 1
RXD[7:0]
→
Data N
TXSTOP = 1
Saddr/R
→
TXD[7:0]
RXD[7:0]
→
Data 1
TXNACK = 1
RXD[7:0]
→
Data (N-1)
RBFIF = 1
RBFIF = 1
TXSTOP = 0
STOPIF = 1
TXSTOP = 0
STOPIF = 1
Saddr/R
A
Data 1
A
Data 2
A
Data N
P
A
I
2
C bus
A
A
NACKIF = 1
TXSTART = 1
TXSTOP = 1
TXSTOP = 0
STOPIF = 1
P
A
NACKIF = 1
TXSTART = 1
Sr
A
S
TXSTART = 0
STARTIF = 1
TBEIF = 1
TXSTART = 0
STARTIF = 1
TBEIF = 1
TXSTOP = 0
STOPIF = 1
P
Sr
Software bit operations
Operations by I2C (master mode)
S: START condition, Sr: Repeated START condition, P: STOP condition,
A: ACK, A: NACK, Saddr/R: Slave a R(1), Data n: 8-bit data
Hardware bit operations
Operations by the external slave
Standby state (SCL = low)
RBFIF = 1
TXNACK = 0
RBFIF = 1
TXNACK = 0
RBFIF = 1
TXNACK = 0
Figure 13.4.3.1 Example of Data Receiving Operations in Master Mode
Data reception
Write 1 to the I2CnCTL.TXNACK bit
YES
NO
One-byte reception?
End
Write slave address and READ(1) to
the I2CnTXD register
Write 1 to the I2CnCTL.TXSTOP bit
Write 1 to the I2CnCTL.TXSTART bit
YES
NO
YES
I2CnINTF.RBFIF = 1?
YES
NO
NO
YES
Last data received?
No
Retry?
Wait for an interrupt request
(I2CnINTF.TBEIF = 1)
Wait for an interrupt request
(I2CnINTF.STOPIF = 1)
Wait for an interrupt request
(I2CnINTF.RBFIF = 1 or I2CnINTF.NACKIF = 1)
Write 1 to the I2CnCTL.TXNACK bit
Write 1 to the I2CnCTL.TXSTOP bit
Receive last data next?
Read receive data from the I2CnRXD register
Read receive data from the I2CnRXD register
Figure 13.4.3.2 Master Mode Data Reception Flowchart