STC8A8K64D4 Series Manual
if (I2CSLST & 0x40)
{
I2CSLST &= ~0x40;
}
else if (I2CSLST & 0x20)
{
I2CSLST &= ~0x20;
if (isda)
{
isda = 0;
}
else if (isma)
{
isma = 0;
addr = I2CRXD;
I2CTXD = buffer[addr];
}
else
{
buffer[addr++] = I2CRXD;
}
}
else if (I2CSLST & 0x10)
{
I2CSLST &= ~0x10;
if (I2CSLST & 0x02)
{
I2CTXD = 0xff;
}
else
{
I2CTXD = buffer[++addr];
}
}
else if (I2CSLST & 0x08)
{
I2CSLST &= ~0x08;
isda = 1;
isma = 1;
}
}
}
Assembly code
;Operating frequency for test is 11.0592MHz
P_SW2
DATA
I2CCFG
XDATA
I2CMSCR
XDATA
I2CMSST
XDATA
I2CSLCR
XDATA
I2CSLST
XDATA
I2CSLADR
XDATA
I2CTXD
XDATA
I2CRXD
XDATA
0BAH
0FE80H
0FE81H
0FE82H
0FE83H
0FE84H
0FE85H
0FE86H
0FE87H
//Handle the START event
//Handle the RECV event
//Handle the RECV event (RECV DEVICE ADDR)
//Handle the RECV event (RECV MEMORY ADDR)
//Handle the RECV event (RECV DATA)
//Handle the SEND event
//Stop receiving data when receiving NAK
//Continue reading data when receiving ACK
//Handle the STOP event
- 619 -
Need help?
Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?