Datasheet
V850ES/JG3-H, V850ES/JH3-H CHAPTER 19 I
2
C BUS
R01UH0042EJ0500 Rev.5.00 Page 882 of 1513
Aug 12, 2011
19.16.3 Slave operation
The following shows the processing procedure of slave operation.
Basically, the operation of the slave device is event-driven. Therefore, processing by an INTIICn interrupt (processing
requiring a significant change of the operation status, such as stop condition detection during communication) is necessary.
The following description assumes that data communication does not support extension codes. Also, it is assumed that
the INTIICn interrupt servicing performs only status change processing and that the actual data communication is
performed during the main processing.
Figure 19-20. Overview of Software During Slave Operation
I
2
C
INTIICn signal
Setting, etc.
Setting, etc.
Flag
Data
Main processing
Interrupt servicing
Therefore, the following three flags are prepared so that the data transfer processing can be performed by passing
these flags to the main processing instead of the INTIICn signal.
(1) Communication mode flag
This flag indicates the following communication statuses.
Clear mode: Data communication not in progress
Communication mode: Data communication in progress (valid address detection stop condition detection, ACK from
master not detected, address mismatch)
(2) Ready flag
This flag indicates that data communication is enabled. This is the same status as an INTIICn interrupt during normal
data transfer. This flag is set in the interrupt processing block and cleared in the main processing block. The ready
flag for the first data for transmission is not set in the interrupt processing block, so the first data is transmitted without
clear processing (the address match is regarded as a request for the next data).
(3) Communication direction flag
This flag indicates the direction of communication and is the same as the value of IICSn.TRCn bit.
The following shows the operation of the main processing block during slave operation.
I
2
C0n starts and waits for the communication enable status. When communication is enabled, I
2
C0n performs transfer
using the communication mode flag and ready flag (the processing of the stop condition and start condition is performed
by interrupts, conditions are confirmed by flags).
For transmission, the transmission operation is repeated until the master device stops returning ACK. When the master
device stops returning ACK, transfer is complete.