Transmitting Each Data Byte
After each data byte transmits, the IFLG is set, and one of the three status codes in Table
| Table | |||
|
|
|
|
|
Code | I2C State |
| Microprocessor Response | Next I2C Action |
28h | Data byte transmitted, |
| Write byte to DAT, clear IFLG | Transmit data byte, receive ACK |
| ACK received |
| OR |
|
|
|
|
| |
|
|
| Set STA, clear IFLG | Transmit repeated START |
|
|
| OR |
|
|
|
| Set STP, clear IFLG | Transmit STOP |
|
|
| OR |
|
|
|
| Set STA and STP, clear IFLG | Transmit START then STOP |
30h | Data byte transmitted, |
| Same as code 28h | Same as code 28h |
| ACK not received |
|
|
|
38h | Arbitration lost |
| Clear IFLG | Return to idle |
|
|
| OR |
|
|
|
| Set STA, clear IFLG | Transmit START when bus free |
All Bytes Transmit Completely
When all bytes transmit completely, set the STP bit by writing a 1 to this bit in the Control register. The I2C controller:
Transmits a STOP condition Clears the STP bit Returns to the idle state
Master Receive Mode
In master receive mode, the I2C controller receives a number of bytes from a slave transmitter. After the START condition transmits:
1.The IFLG bit is set and status code 08h is in the Status register.
2.The Data register has the slave address (or the first part of a
3.The IFLG bit is 0 and prompts the transfer to continue.
4.When the
A number of status codes are possible in the Status register, as shown in Table
Note: In
16