MS51
Nov. 28, 2019 Page 421 of 491 Rev 1.00
MS51 32K SERIES TECHNICAL REFERENCE MANUAL
AA = 1;
break;
//======================
//Slave Transmitter Mode
//======================
case 0Xa8: /*A8H, own SLA+R received, ACK returned*/
I2DAT = NEXT_SEND_DATA3;
AA = 1; //when AA is “1”, not last data to be
//transmitted
break;
case 0Xb0: /*B0H, arbitration lost in SLA+W/R
own SLA+R received, ACK returned */
I2DAT = DUMMY_DATA;
AA = 0; //when AA is “0”, last data to be
//transmitted
STA = 1; //retry to transmit START if bus free
break;
case 0Xb8: /*B8H, previous own SLA+R, DATA
transmitted,
ACK received*/
I2DAT = NEXT_SEND_DATA4;
if (To_TX_Last_Data) //if last DATA will be transmitted
AA = 0;
else
AA = 1;
break;
case 0Xc0: /*C0H, previous own SLA+R, DATA
transmitted,
NACK received, not addressed SLAVE
mode
entered*/
AA = 1;
break;
case 0Xc8: /*C8H, previous own SLA+R, last DATA trans-
mitted, ACK received, not addressed
SLAVE
AA = 1; mode entered*/
break;
}//end of switch (I2STAT)
SI = 0; //SI should be the last command of
I
2
C ISR
while(STO); //wait for STOP transmitted or bus
error
//free, STO is cleared by hardware
}
6.11.4 I
2
C Time-Out
There is a 14-bit time-out counter, which can be used to deal with the I
2
C bus hang-up. If the time-out
counter is enabled, the counter starts up counting until it overflows. Meanwhile I2TOF will be set by
hardware and requests I
2
C interrupt. When time-out counter is enabled, setting flag SI to high will
reset counter and restart counting up after SI is cleared. If the I
2
C bus hangs up, it causes the SI flag
not set for a period. The 14-bit time-out counter will overflow and require the interrupt service.