如果出现了错误,消息“1”中的代码将挂起(I2C2STATBITS.RBF=0);如果前面的语句:I2C2CONBITS.RCEN返回到0,则没有接收到字节,那么等待RBF将无济于事。迈西尔
以上来自于百度翻译
以下为原文
If there is something wrong, code shown in message #1 will hang in the
while ( I2C2STATbits.RBF == 0);
loop.
If a byte have not been received when the previous statement: I2C2CONbits.RCEN go back to 0,
then waiting for RBF will not help.
if (I2C2STATbits.RBF == 0) //check for response
{ __debug_break();
// test what went wrong
// what is value of I2C2STATbits.BCL
// what is value of I2C2STATbits.IWCOL
// what other values in I2C2STAT
if (I2C2STATbits.S == 1)
I2C_stop();
return error;
}
Mysil
如果出现了错误,消息“1”中的代码将挂起(I2C2STATBITS.RBF=0);如果前面的语句:I2C2CONBITS.RCEN返回到0,则没有接收到字节,那么等待RBF将无济于事。迈西尔
以上来自于百度翻译
以下为原文
If there is something wrong, code shown in message #1 will hang in the
while ( I2C2STATbits.RBF == 0);
loop.
If a byte have not been received when the previous statement: I2C2CONbits.RCEN go back to 0,
then waiting for RBF will not help.
if (I2C2STATbits.RBF == 0) //check for response
{ __debug_break();
// test what went wrong
// what is value of I2C2STATbits.BCL
// what is value of I2C2STATbits.IWCOL
// what other values in I2C2STAT
if (I2C2STATbits.S == 1)
I2C_stop();
return error;
}
Mysil
举报