Datasheet

Section 16 I
2
C Bus Interface 2 (IIC2) (Option)
Rev.7.00 Mar. 18, 2009 page 798 of 1136
REJ09B0109-0700
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 RDR
F in ICSR
Write BBSY = 0
and SCP = 0
Read STOP of ICSR
Read ICDRR
Set RCVD = 0 (ICCRA)
Set MST = 0 (ICCRA)
End
Note: * Ensure that no interrupts are received while steps [1] through [3] are being processed.
A
dditional information: If only one byte is received, steps [2] through [6] are omitted following step [1],
and processing jumps to step [7].
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]
Clear ACKBT in ICIER
[15]
Figure 16.15 Sample Flowchart for Master Receive Mode