DSP(TMS320C6713)入门之旅五、I2C的理解和使用 下载本文

for(i=0;i

{

while(!I2C_rrdy(hI2C));

ReceiveData[i] =I2C_readByte(hI2C); }

I2C_sendStop(hI2C);

printf(“\\nReading data is over.”);

/* Comparing data. */ for(i=0;i

{

if(ReceiveData[i] != DataByte[i]) {

printf(“\\nOperation is failure.”); exit(0); } }

printf(“\\nOperation is success.”); }

/********************************************************************************/ //This function waits until the I2C bus busy bit is reset waitForBusFree(I2C_Handle hI2C) {

//Waiting for Bit12 of ICSTR ie. BB (Bus Busy) to clear while(I2C_bb(hI2C)); }

//This function waits untill the I2C bus busy bit gets set waitForBusBusy(I2C_Handle hI2C) {

//Waiting for Bit12 of ICSTR ie. BB (Bus Busy) to set

while(!I2C_bb(hI2C)); }

/********************************************************************************/ /********************************************************************************\\ \\* End of DEC6713_EEPROM.C *\\

\\********************************************************************************/