slave发送的数据时3个元素的数组Txdata,代码如下:
else if(u32Status == 0xA8) /* Own SLA+R has been receive; ACK has been return */
{
printf(" rev self addr+R,Send ACK,will send data and rev ACK\r\n");
I2C_SET_DATA(I2C0, Txdata[Txlen]);
printf("Txdata[%d] = %d",Txlen,Txdata[Txlen]);
Txlen ++;
if(Txlen == 3)
{
Txlen = 0;
I2C_SET_CONTROL_REG(I2C0, I2C_I2CON_SI_AA);
}
}
else if(u32Status == 0xC0) /* Data byte or last data in I2CDAT has been transmitted
Not ACK has been received */
{
printf("data trans was completed and send NO ACK\r\n");
I2C_SET_CONTROL_REG(I2C0, I2C_I2CON_SI_AA);