/* 1. Compiler: TC 2.0 2. Mode: Small 3. Project: Eeprom-w.prj Eeprom-w.c ..\lib\8000l.lib ..\lib\tcpipl.lib 4. Explain: (1). Writting a value to EEPROM. (2). The value will auto-plus 1 when it's writted to next address. 5. Hordware: 8831 with EEPROM It's compiled by Tony ------------------------------------------------------------------------------- */ #include #include #include #include #include #include"..\LIB\8000.h" #include"..\LIB\vxcomm.h" /*-----------------------------------------------------*/ main() { int i,j,addr=0,block,data; int type; int ver; type=Is8000(); /*detect the current operation system*/ if(type) { ver=GetLibVersion(); Print("Hello 8831! (Flash memory is %d K)\n\r",type); Print("Library version is %d.%02d",ver>>8,ver&0xff); } else { Print("Hello PC!, this program is not run under I-8831."); return; } Print("Warning:The block of 0 address is used by system\n"); Print("\r\nPLease insert a value writting to 1 block of EEPROM only:"); Scanf("%d",&data); EE_WriteEnable(); while (addr<256){ WriteEEP(1,addr,data); Print("\rWritting the value %d to address %d of EEPROM\n",data,addr); addr=addr++,data=data++; } EE_WriteProtect(); }