我这样存 老是存不了后面的16个数组 下面是我存入和读取方法 是哪里不正确;存入我加入延时就读取不了
//存入EEprom
if(HAL_I2C_Mem_Write(&hi2c2, ADDR_24LCxx_Write, 0, I2C_MEMADD_SIZE_8BIT,&I2C_WriteBuffer[0],16, 0x10) == HAL_OK)
{
}
else
{
}
//HAL_Delay(500);
if(HAL_I2C_Mem_Write(&hi2c2, ADDR_24LCxx_Write, 2, I2C_MEMADD_SIZE_8BIT,&I2C_WriteBuffer[16],16, 0x10) == HAL_OK)
{
}
else
{
//
}
//读------------------------------
if( HAL_I2C_Mem_Read(&hi2c2, ADDR_24LCxx_Read, 0, I2C_MEMADD_SIZE_8BIT,I2C_ReadBuffer,32,0xFF) == HAL_OK){
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, GPIO_PIN_SET);
printf("rn EEPROM 24C02 READ0 rn");
HAL_GPIO_TogglePin(GPIOB,GPIO_PIN_5);
for(i = 0;i<32;i++){
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, GPIO_PIN_SET);
printf("0x%02X ",I2C_ReadBuffer
);
HAL_GPIO_TogglePin(GPIOB,GPIO_PIN_5);
}
我这样存 老是存不了后面的16个数组 下面是我存入和读取方法 是哪里不正确;存入我加入延时就读取不了
//存入EEprom
if(HAL_I2C_Mem_Write(&hi2c2, ADDR_24LCxx_Write, 0, I2C_MEMADD_SIZE_8BIT,&I2C_WriteBuffer[0],16, 0x10) == HAL_OK)
{
}
else
{
}
//HAL_Delay(500);
if(HAL_I2C_Mem_Write(&hi2c2, ADDR_24LCxx_Write, 2, I2C_MEMADD_SIZE_8BIT,&I2C_WriteBuffer[16],16, 0x10) == HAL_OK)
{
}
else
{
//
}
//读------------------------------
if( HAL_I2C_Mem_Read(&hi2c2, ADDR_24LCxx_Read, 0, I2C_MEMADD_SIZE_8BIT,I2C_ReadBuffer,32,0xFF) == HAL_OK){
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, GPIO_PIN_SET);
printf("rn EEPROM 24C02 READ0 rn");
HAL_GPIO_TogglePin(GPIOB,GPIO_PIN_5);
for(i = 0;i<32;i++){
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, GPIO_PIN_SET);
printf("0x%02X ",I2C_ReadBuffer
);
HAL_GPIO_TogglePin(GPIOB,GPIO_PIN_5);
}
举报