BAT32G1x9 user manual | Chapter 20 Serial interface IICA
778 / 1149
Rev.1.02
(3) Slave run
The processing steps for a slave run are as follows.
Slave operations are basically event-driven, so they need to be handled through INTIICAn interrupts (large
changes to the operating state such as stop condition detection in communications) need to be handled).
In this description, it is assumed that the data communication does not support extension codes, THATICAn
interrupt processing only performs state transition processing, and that the actual data communication is carried out
by the main processing department.
IICA
interrupt
handling
main process
configurati
on
etc.
Data
configuratio
n
etc.
INTIICAn
flag
Therefore, the following three flags are prepared and pass the flags to the main processing department instead
of INTRAICAn for data communication processing.
①
Communication mode flags
This flag indicates the following 2 communication states:
•
Clear Mode: Not in the state of data communication
• Communication mode: The status of the data communication in progress (detection of valid address ~
detection of stop condition, response of the master device not detected, address different).
(2) Ready sign
This flag indicates that data communication can take place. In the usual data communication, as with the INTIICAn
interrupt, the interrupt processing department is placed and cleared by the main processing department. When
communication begins, the flag is cleared by interrupt handling. However, when sending the first data, interrupt
processing does not set the ready flag in place, so the first data is sent without clearing the flag (address matching is
interpreted as the next data request).
(3) Communication direction signs
This flag indicates the direction of communication, which is the same as the value of the TRCn bit.
Note n = 0,1
The run of the main processing unit of the slave run is as follows.
Start the serial interface IICA and wait to become communicative. If it becomes communicatable, the
communication mode flag and the ready flag are used to communicate (because the processing of the stop
condition and start condition is carried out by interrupt, the status is confirmed here by the flag).
At send time, the send is repeated until the master device does not return a reply. If the master does not return
an Ack, the communication ends. At the time of receiving, receive the required amount of data. If the
communication ends, no reply is returned at the next data. After that, the master device generates a stop condition
or a restart condition, thereby exiting the communication state.