DSP中i2c存储eeprom实例分析(4)

2019-01-19 10:25

}

//检查完毕

} }

} // end of stop condition detected // Interrupt source = Register Access Ready

// This interrupt is used to determine when the EEPROM address setup portion of the //该中断用于判断读数据通讯中何时完成EEPROM数据地址的设置;

// read data communication is complete. Since no stop bit is commanded, this flag //由于不产生停止位,这个标志(ARDY)告诉我们地址数据是否发送完成。 // tells us when the message has been sent instead of the SCD flag. If a NACK is //如果收到NACK,清除NACK位,并设置产生一个停止位。

// received, clear the NACK bit and command a stop. Otherwise, move on to the read //否则,继续读取通讯数据。

// data portion of the communication. else if(IntSource == I2C_ARDY_ISRC) //IIC模块准备好中断:包括【复位,发完一个数据单元(1~8bits的数据)

{ //却没收到ACK/STOP或者出现counter=0】都可引发该中断 ARDY_ISRC_number++;

if(I2caRegs.I2CSTR.bit.NACK == 1) //因为EEPROM处理数据忙而回复的NACK {

I2caRegs.I2CMDR.bit.STP = 1; //产生一个STOP停止位,从而引发一次SCD中断。 I2caRegs.I2CSTR.all = I2C_CLR_NACK_BIT; //清除NACK位

ARDY_ISRC_NACK_number++;

}

else if(CurrentMsgPtr->MsgStatus == I2C_MSGSTAT_SEND_NOSTOP_BUSY) {

CurrentMsgPtr->MsgStatus = I2C_MSGSTAT_RESTART;//更新为重发START位状态,为接收数据准备 }

} // end of register access ready else {

// Generate some error due to invalid interrupt source asm(\ ESTOP0\ }

// Enable future I2C (PIE Group 8) interrupts

PieCtrlRegs.PIEACK.all = PIEACK_GROUP8; //重启中断允许 }

void pass()

{

asm(\ ESTOP0\ for(;;); } void fail() {

asm(\ ESTOP0\ for(;;); }

//=========================================================================== // No more.

//===========================================================================


DSP中i2c存储eeprom实例分析(4).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:[推荐下载]产品结构工程师简历范文-word范文模板(2页)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: