电源是PIC32和EEPROM的常用电源。我给I2C EEPROM写了5次,给出了E.EncDATA.I2CSTATE==EEPROMYI2C2IDLE;而(i(5))if((EEPRODATA.I2CSTATE==EEPROMETII2CYALE))(EEPROMEDATIONI2CSTATE==EEPROMETII2CYSTART){MMESET(EEPROMWORTELCOC,0,40);EEPROMYROC。0);/ / EEPROM EEPROMWORTELCO.[地址]字节EEPROMYROC。字节[0 ];EEPROMWORDELCOC [1 ]=EEPROMETHOROC。字节[1 ];STRCAT(和;EEPROMWORDELCOC(2),“Hello”);EEPROMDEATA.I2CSTATEE= EEPROMYI2C2写;EEPROMYI2C2DATAWAWWRADE();否则,如果(EEPRODATA.I2CSTATE==EEPROMETII2CWAITITX写){ReT1= EEPROMYI2C2DATAWAWRADE();(//trueIf(EEPRODATA.I2cBuffeEngult==DrvII2CyBuffelyEvestRoad完成)//false(EEPRODATA.I2CBuffeEngult==DRVIII2CyBuffrEythEngError错误)如果(ReT1=1){EEPRODATA.I2CSTATE==EEPROMETII2CYIDLE;I++;RIT1=0;}}
以上来自于百度翻译
以下为原文
power source is common for PIC32 and EEPROM.
I am writing to I2C EEPROM for 5 times as given below.
eepromData.i2cStates == EEPROM_I2C_IDLE;
while(i<5)
{
if((eepromData.i2cStates == EEPROM_I2C_IDLE)||(eepromData.i2cStates==EEPROM_I2C_START))
{
memset(EEPROMWriteloc,0,40);
EEPROM_loc.word=EEPROM_Section(0); //address of eeprom
EEPROMWriteloc[0]=EEPROM_loc.byte[0];
EEPROMWriteloc[1]=EEPROM_loc.byte[1];
strcat(&EEPROMWriteloc[2],"hello");
eepromData.i2cStates = EEPROM_I2C_WRITE;
EEPROM_I2C_DATA_WRITE();
}else if(eepromData.i2cStates == EEPROM_I2C_WAIT_WRITE)
{
ret1=EEPROM_I2C_DATA_WRITE();
//true is if(eepromData.I2CBufferEvent ==DRV_I2C_BUFFER_EVENT_COMPLETE)
//false if(eepromData.I2CBufferEvent == DRV_I2C_BUFFER_EVENT_ERROR)
if(ret1==1)
{
eepromData.i2cStates == EEPROM_I2C_IDLE;
i++;
ret1=0;
}
}
}
电源是PIC32和EEPROM的常用电源。我给I2C EEPROM写了5次,给出了E.EncDATA.I2CSTATE==EEPROMYI2C2IDLE;而(i(5))if((EEPRODATA.I2CSTATE==EEPROMETII2CYALE))(EEPROMEDATIONI2CSTATE==EEPROMETII2CYSTART){MMESET(EEPROMWORTELCOC,0,40);EEPROMYROC。0);/ / EEPROM EEPROMWORTELCO.[地址]字节EEPROMYROC。字节[0 ];EEPROMWORDELCOC [1 ]=EEPROMETHOROC。字节[1 ];STRCAT(和;EEPROMWORDELCOC(2),“Hello”);EEPROMDEATA.I2CSTATEE= EEPROMYI2C2写;EEPROMYI2C2DATAWAWWRADE();否则,如果(EEPRODATA.I2CSTATE==EEPROMETII2CWAITITX写){ReT1= EEPROMYI2C2DATAWAWRADE();(//trueIf(EEPRODATA.I2cBuffeEngult==DrvII2CyBuffelyEvestRoad完成)//false(EEPRODATA.I2CBuffeEngult==DRVIII2CyBuffrEythEngError错误)如果(ReT1=1){EEPRODATA.I2CSTATE==EEPROMETII2CYIDLE;I++;RIT1=0;}}
以上来自于百度翻译
以下为原文
power source is common for PIC32 and EEPROM.
I am writing to I2C EEPROM for 5 times as given below.
eepromData.i2cStates == EEPROM_I2C_IDLE;
while(i<5)
{
if((eepromData.i2cStates == EEPROM_I2C_IDLE)||(eepromData.i2cStates==EEPROM_I2C_START))
{
memset(EEPROMWriteloc,0,40);
EEPROM_loc.word=EEPROM_Section(0); //address of eeprom
EEPROMWriteloc[0]=EEPROM_loc.byte[0];
EEPROMWriteloc[1]=EEPROM_loc.byte[1];
strcat(&EEPROMWriteloc[2],"hello");
eepromData.i2cStates = EEPROM_I2C_WRITE;
EEPROM_I2C_DATA_WRITE();
}else if(eepromData.i2cStates == EEPROM_I2C_WAIT_WRITE)
{
ret1=EEPROM_I2C_DATA_WRITE();
//true is if(eepromData.I2CBufferEvent ==DRV_I2C_BUFFER_EVENT_COMPLETE)
//false if(eepromData.I2CBufferEvent == DRV_I2C_BUFFER_EVENT_ERROR)
if(ret1==1)
{
eepromData.i2cStates == EEPROM_I2C_IDLE;
i++;
ret1=0;
}
}
}
举报