687
Chapter 33 I2C Controller
4.Programming Flow Charts
4. Programming Flow Charts
■ Example Of Slave Addressing And Sending Data
Addressing a 7 bit slave Sending data
Start
IDAR0 := sl.address<<1+RW;
MSS := 1; INT := 0
INT=1?
ACK?
(LRB=0?)
AL=1?
Enable Interface EN:=1;
Clear BER bit (if set);
N
N
BER=1?
Y
N
Ready to send data
Start
INT=1?
ACK?
(LRB=0?)
AL=1?
Address slave for write
Last byte
transferred?
N
N
Y
BER=1?
Y
IDAR0 := Data Byte;
INT := 0
N
N
N
Y
Y
Y
Y
Y
Bus error
N
stop condition
repeated start or
Generate
Generate
repeated start
or stop condition
Transfer End
Slave did not ACK
Restart
transfer
Check
if AAS
Restart
transfer
Check
if AAS
Y