2009-06-28 02:08 AM
Error in FW-Library example - write over eeprom page
2011-05-17 04:16 AM
Hi,
it seems that I have found an error in the I2C eeprom example: ... void EE_BufferWrite(u8* pBuffer, u16 WriteAddr, u16 NumByteToWrite) { u8 NumOfPage = 0, NumOfSingle = 0, Addr = 0, count = 0; Addr = WriteAddr % EE_PageSize; count = EE_PageSize - Addr; NumOfPage = NumByteToWrite / EE_PageSize; // ERROR this is not sufficient // added code start ... ############################################ if((NumByteToWrite < EE_PageSize) && ((Addr+NumByteToWrite) > EE_PageSize)) NumOfPage++; // ###############################################... added code end NumOfSingle = NumByteToWrite % EE_PageSize; ... The problem was that I have to write less than page bytes over a page border. With the added lines it seems to works correctly. Hope it is useful for someone. Best regards [ This message was edited by: pt1 on 28-06-2009 14:40 ] [ This message was edited by: pt1 on 28-06-2009 14:40 ]