CHAPTER 16 I
2
C BUS
User’s Manual U16896EJ2V0UD
480
16.5.4 ACK
ACK is used to confirm the serial data status of the transmitting and receiving devices.
The receiving device returns ACK for every 8 bits of data it receives.
The transmitting device normally receives ACK after transmitting 8 bits of data. When ACK is returned from the
receiving device, the reception is judged as normal and processing continues. The detection of ACK is confirmed with
the IICS0.ACKD0 bit.
When the master device is the receiving device, after receiving the final data, it does not return ACK and generates
the stop condition. When the slave device is the receiving device and does not return ACK, the master device
generates either a stop condition or a restart condition, and then stops the current transmission. Failure to return ACK
may be caused by the following factors.
<1> Reception was not performed normally.
<2> The final data was received.
<3> The receiving device (slave) does not exist for the specified address.
When the receiving device sets the SDA0 line to low level during the ninth clock, ACK is generated (normal
reception).
When the IICC0.ACKE0 bit is set to 1, automatic ACK generation is enabled. Transmission of the eighth bit
following the 7 address data bits causes the IICS0.TRC0 bit to be set. Normally, set the ACKE0 bit to 1 for reception
(TRC0 bit = 0).
When the slave device is receiving (when TRC0 bit = 0), if the slave device cannot receive data, clear the ACKE0
bit to 0 to indicate to the master that no more data can be received.
Similarly, when the master device is receiving (when TRC0 bit = 0) and the subsequent data is not needed, clear
the ACKE0 bit to 0 to prevent ACK from being generated. This notifies the slave device (transmitting device) of the
end of the data transmission (transmission stopped).
Figure 16-8. ACK
SCL0
1
SDA0
2
3
4
5
6
7
8
9
AD6
AD5
AD4
AD3
AD2
AD1
AD0
R/W ACK
When the local address is received, ACK is automatically generated regardless of the value of the ACKE0 bit. No
ACK is generated if the received address is not a local address (NACK).
When receiving the extension code, set the ACKE0 bit to 1 in advance to generate ACK.
The ACK generation method during data reception is based on the wait timing setting, as described by the following.
•
When 8-clock wait is selected (IICC0.WTIM0 bit = 0):
ACK is generated at the falling edge of the SCL0 pin’s eighth clock if the ACKE0 bit is set to 1 before the wait
state cancellation.
•
When 9-clock wait is selected (WTIM0 bit = 1):
ACK is generated if the ACKE0 bit is set to 1 in advance.
<R>