/* 1. Compiler: TC 2.0 2. Mode: large 3. Project: Nvram-w.prj Nvram-w.c ..\lib\8000l.lib ..\lib\tcpipl.lib 4. Explain: (1) Input a value and write to NVRAM. (2) The value will write to the address of NVRAM from 0 to 30. (3) The value will plus 1 by auto when it is werited to next address. 5. Hordware: 8831 It's compiled by Tony ----------------------------------------------------------------------------------- */ #include #include #include #include #include #include"..\LIB\8000.h" #include"..\LIB\vxcomm.h" /*---------------------------------------------------------------------------------*/ void main(void) { int addr=0,data; int type; int ver; type=Is8000(); /*detect the crrrent operation system*/ if(type) /*if it's used in minios7*/ { ver=GetLibVersion(); Print("Hello 8831! (Flash memory is %d K)\n\r",type); Print("Library version is %d.%02d",ver>>8,ver&0xff); } else /*if it's used in dos*/ { Print("Hello PC!, this program is not run under 8831."); return; } Print("PLease insert a valume to write to NVRAM:"); Scanf("%d",&data); while(addr<31) { DelayMs(10); WriteNVRAM(addr,data); Print("\n\rWrite the valume %d to RVRAM address %d",data,addr); addr=addr++,data=data++; } }