Datasheet
Section 15 I
2
C Bus Interface2 (IIC2) (Option)
Rev.6.00 Mar. 18, 2009 Page 655 of 980
REJ09B0050-0600
No
Yes
RDRF=1 ?
No
Yes
RDRF=1 ?
(Last receive
- 1)?
Mater receive mode
Clear TEND in ICSR
Set TRS = 0 (ICCRA)
Clear TDRE of ICSR
Set ACKBT = 0 (ICIER)
Dummy read ICDRR
Read RDRF in ICSR
Read ICDRR
Set ACKBT = 1 (ICIER)
Set RCVD - 1 (ICCRA)
Read ICDRR
Read RDRF in ICSR
Write BBSY = 0
and SCP = 0
Read STOP of ICSR
Read ICDRR
Set RCVD = 0 (ICCRA)
Set MST = 0 (ICCRA)
End
No
Yes
STOP=1 ?
No
Yes
[1] Clear TEND, select master receive mode, and then clear TDRE.
*
[2] Set acknowledge to the transmitting device.
*
[3] Dummy read ICDDR
*
[4] Wait for 1 byte to be received.
[5] Check if (last receive - 1)
[6] Read the receive data, and clear RDRF to 0.
[7] Set acknowledge of the final byte. Disable continuous receive (RCVD = 1).
[8] Read receive data of (final byte - 1), and clear RDRF to 0.
[9] Wait for the final byte to be received.
[10] Clear STOP flag.
[11] Stop condition issuance
[12] Wait for the creation of stop condition.
[13] Read the receive data of the final byte, and clear RDRF to 0.
[14] Clear RCVD to 0.
[15] Clear ACKBT.
[16] Set slave receive mode.
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
Clear STOP of ICSR
[10]
[9]
[11]
[12]
[13]
[14]
[16]
Note: * Prevent any interrupts while steps [1] to [3] are executed.
Additional information: When receiving one-byte data, execute step [1], and then step [7] omitting steps [2] to [6].
In step [8], dummy read ICDRR.
Clear ACKBT of ICIER
[15]
Figure 15.15 Sample Flowchart for Master Receive Mode