/* EEPROM-w: 1. Input a value and stores it in an EEPROM block 16 peer address. 2. Value will automatically increase by 1. Compiler: BC++ 3.1, Turbo C++ 1.01 (3.01) MSVC 1.52 Compile mode: Large Project: EEPROM-w.c ..\..\Lib\upac5000.lib Hordware: uPAC-5000 Description The uPAC-5000 module contains 16K bytes of EEPROM which includes space reserved for the system. The EEPROM is designed to store data that is not changed frequently. The erase /write cycle of the EEPROM is limited to 1,000,000 erase/write cycles, so it should not be changed frequently when testing. The first 4K bytes (Block 0 ~ 15) reserved for the system, so user can use the other blocks whose total size of 12K bytes. [Dec 28, 2011] by Liam */ #include #include "..\..\lib\upac5000.h" void main(void) { int addr=0, data; InitLib(); Print("\r\nPlease insert a value writting to block 16 of EEPROM only: "); Scanf("%d", &data); EE_WriteEnable(); while(addr<256) { EE_RandomWrite(16, addr, data); Print("\rWritting the value %d to address %d of EEPROM\n", data, addr); addr=addr++, data=data++; } EE_WriteProtect(); }