/* 1. Compiler: TC 2.0 2. Mode: Large 3. Project: Flash-w.prj Flash-r.c ..\lib\8000l.lib ..\lib\tcpipl.lib 4. Explain: (1). To write a value which you input to flash memory at segment 0x9000 which offset is 0 to 65535 and show it on monitor. (2). The value you input will write to Flash memory and auto-plus 1. * Press 'q' or 'Q' to quit program. 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 seg,data; char c; unsigned e=0x9000,i=0; 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("\r\nPlease Input a value writting to segment 0x9000 of Flash Member:"); Scanf("%d",&seg); FlashErase(e); while(i<65535){ FlashWrite(e,i,seg); Print("\r\nThe value %d is writting to offset %d of Flash Memory",seg,i); i++;seg++; if(i%100==0){ Print("\r\nPress q to quit or any key to continue...");c=Getch(); if ((c=='q') || (c=='Q')) return; } } }