MS51
Dec. 17, 2019
Page
280
of 316
Rev 1.01
M
S51
SE
RIES
TE
CHNICA
L REF
ERE
N
CE MA
NU
A
L
case 0x20:
/*20H, SLA+W transmitted, NACK received*/
STO = 1;
//transmit STOP
AA = 1;
//ready for ACK own SLA+W/R or General Call
break;
case 0x28:
/*28H, DATA transmitted, ACK received*/
if (Conti_TX_Data)
//if continuing to send DATA
I2DAT = NEXT_SEND_DATA2;
else
//if no DATA to be sent
{
STO = 1;
AA = 1;
}
break;
case 0x30:
/*30H, DATA transmitted, NACK received*/
STO = 1;
AA = 1;
break;
//===========
//Master Mode
//===========
case 0x38:
/*38H, arbitration lost*/
STA = 1;
//retry to transmit START if bus free
break;
//====================
//Master Receiver Mode
//====================
case 0x40:
/*40H, SLA+R transmitted, ACK received*/
AA = 1;
//ACK next received DATA
break;
case 0x48:
/*48H, SLA+R transmitted, NACK received*/
STO = 1;
AA = 1;
break;
case 0x50:
/*50H, DATA received, ACK transmitted*/
DATA_RECEIVED1 = I2DAT;
//store received DATA
if (To_RX_Last_Data1) //if last DATA will be received
AA = 0;
//not ACK next received DATA
else
//if continuing receiving DATA
AA = 1;
break;
case 0x58:
/*58H, DATA received, NACK transmitted*/
DATA_RECEIVED_LAST1 = I2DAT;
STO = 1;
AA = 1;
break;
//====================================
//Slave Receiver and General Call Mode
//====================================
case 0x60:
/*60H, own SLA+W received, ACK returned*/
AA = 1;
break;
case 0x68:
/*68H, arbitration lost in SLA+W/R
own SLA+W received, ACK returned */
AA = 0;
//not ACK next received DATA after
//arbitration lost
STA = 1;
//retry to transmit START if bus free
break;