/* Nvram-w.c: 1. Input an integer and write to NVRAM. 2. The integer will write to the address of NVRAM from 0 to 30. 3. The integer will be increased by 1 when it is written to next address. Compiler: BC++ 3.1, Turbo C++ 1.01 (3.01) MSVC 1.52 Compile mode: Large Project: NVRam-w.c ..\..\Lib\upac5000.lib Hordware: uPAC-5000 Description The uPAC-5000 module contains both an RTC and NVRAM, which located on the same chip, and an onboard Li battery that is used as backup for at the least 10 years. [Dec 28, 2011] by Liam */ #include #include #include #include "..\..\lib\upac5000.h" void main(void) { int data, addr=0; InitLib(); Print("Please input a integer to write to NVRAM: "); Scanf("%d", &data); while(addr<31) { DelayMs(10); WriteNVRAM(addr, data); Print("\n\rWrite the integer %d to address %d of the NVRAM", data, addr); addr=addr++; data++; } }