DSP28335I2C接口应用

实用文档

} // end of write section

///////////////////////////////////

// Read data from EEPROM section //该过程包括两次发送START位,第一次发送地址 ///////////////////////////////////

// Check outgoing message status. Bypass read section if status is // not inactive.

if (I2cMsgOut1.MsgStatus == I2C_MSGSTAT_INACTIVE) {

// Check incoming message status.

if(I2cMsgIn1.MsgStatus == I2C_MSGSTAT_SEND_NOSTOP) { Read_load_num1++;

// EEPROM address setup portion

while(I2CA_ReadData(&I2cMsgIn1) != I2C_SUCCESS) {

// Maybe setup an attempt counter to break an infinite while //这里可以设置一个计数器用于终止可能存在的无限循环。 // loop. The EEPROM will send back a NACK while it is performing//当EEPROM忙于处理写数据操作时,将返回一个NACK。 // a write operation. Even though the write communique is //对DSP来说,此刻写操作已经完成。但是,EEPROM仍需要 // complete at this point, the EEPROM could still be busy //一定时间完成数据的烧写1.8ms左右。在EEPROM完成烧写之前,都会

// programming the data. Therefore, multiple attempts are //返回NACK,告诉DSP它还在忙。因此,DSP需要多次尝试,直到

// necessary. //EEPROM空闲了,并返回ACK确认为止。 }

// Update current message pointer and message status CurrentMsgPtr = &I2cMsgIn1;

I2cMsgIn1.MsgStatus = I2C_MSGSTAT_SEND_NOSTOP_BUSY;

//第一次发送START成功,即地址数据已发送成功,给发无停止位数据忙状态,作为第二次发送START位标志 }

// Once message has progressed past setting up the internal address//一旦成功写入EEPROM地址,便可以再次发送START起始位

// of the EEPROM, send a restart to read the data bytes from the //然后从EEPROM存储器中读取数据。 // EEPRO

>>閻忕偞娲栫槐鎴﹀礂閵婏附鐎�<<
12@gma联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4