689
Chapter 33 I2C Controller
4.Programming Flow Charts
■ Example Of An Interrupt Handler
Start
INT=1?
AAS=1?
N
BER=1?
Y
N
Bus error
reenable IF
Y
Y
AL=1?
N
Arbitration
lost
Restart
transfer
Y
LRB=1?
Y
Slave did
not ACK
Generate
stop or
repeated
start
AL=1?
N
Y
ADT=1?
N
Y
Transfer failed
remember to retry
TRX=1?
N
Y
Read received byte
from IDAR0 register
Change ACK bit if
necessary
Put next byte
to be sent in
IDAR0 register
or clear MSS
Clear INT bit
New data transfer
starts at next INT
Change ACK bit
if necessary
TRX=1?
N
Y
Put next byte to be
sent in IDAR0
register
Read received byte
from IDAR0 register
Change ACK bit if
necessary
End ISR
GCA=1?
N
Y
General call
as slave
Interrupt
from other
module
received
N