涉及到EEPROM模块存储数据应用时,在24,27等系列PSOC中由于RAM只有256字节限制,建议不用此模块,因为此模块占用RAM空间大(堆栈占用),容易出错。用flashblock.h下面的函数,很省空间,而且效果不错。 用时要别忘了注意不同系列的这个函数block ID区别。
例如24系列如下: typedef struct { BYTE bARG_BlockId; // block ID BYTE * pARG_FlashBuffer; // flash buffer pointer - 2 bytes CHAR cARG_Temperature; // die Temperature, -40 to 100 BYTE bDATA_PWErase; // Temporary storage (reserved) BYTE bDATA_PWProgram; // Temporary storage (reserved) BYTE bDATA_PWMultiplier; // Temporary storage (reserved) } FLASH_WRITE_STRUCT;
extern BYTE bFlashWriteBlock( FLASH_WRITE_STRUCT * pFlashWriteData );
29系列如下: // FlashWrite argument/data structure typedef struct { WORD wARG_BlockId; // block ID BYTE * pARG_FlashBuffer; // flash buffer pointer - 2 bytes CHAR cARG_Temperature; // die Temperature, -40 to 100 BYTE bDATA_PWErase; // Temporary storage (reserved) BYTE bDATA_PWProgram; // Temporary storage (reserved) BYTE bDATA_PWMultiplier; // Temporary storage (reserved) } FLASH_WRITE_STRUCT;
extern BYTE bFlashWriteBlock( FLASH_WRITE_STRUCT * pFlashWriteData ); // Class 3 function
|