问题描述:之前用DSP自带的IIC通过硬件查询方式实现了IIC字节写入EEPROM 读取多个字节,后来想实现EEPROM的页写,用的是24C64 一页也就是32字节。
IIC写多个字节的函数定义:
void I2C_PageWrite(Uint16 MemoryAddress,Uint16* write_buffer,Uint16 Num_dates)
{
Uint16 i;
// Setup slave address
I2caRegs.I2CSAR=0x0050;
// Setup number of bytes to send
// number of data bytes to be send + Address
I2caRegs.I2CCNT =Num_dates+2;
// Setup memory address data to send
I2caRegs.I2CDXR =0x00;
I2caRegs.I2CDXR =MemoryAddress;
DELAY_US(50);
for(i=0;i<Num_dates;i++)
{
I2caRegs.I2CDXR=write_buffer[i];
}
I2caRegs.I2CMDR.all = 0x6E20;
}
函数调用方式
I2C_PageWrite(MemoryLowAddr,MsgBuffer,32);
请高手帮忙看一下是哪个地方出了问题 |