/* (1)This is a demo program which demonstrate how you can use the GPS function for 7188XA. (2)Connect the DB-9 connector of GPS receiver to COM1 of 7188XA. (3)Then you can transmit the NMEA message to remote host via COM2/3 of 7188XA. Compiler file: GPSDEMO.c 7188XA.lib GPS.lib 2002/02/06 written by Tony */ #include"..\lib\iview.h" #include"..\lib\mmi100.h" #include"..\lib\GPS.h" void main(void) { char nmea[512]; char utc[16]; int type, ver, quit=0, count=0; char pkey,buf; type=IsIview(); /*detect the current operation system*/ if(type){ ver=GetLibVersion(); Print("Hello Iview! (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 Iview."); return; } initLCD2(TEXTATTRIBUTE); clrLCD(); InstallCom2(4800,8,0); while(!quit){ clrLCD(); LCDPrintf(" 1 NMEA \n\r"); LCDPrintf(" 2 GPS info.\n\r"); LCDPrintf(" 3 Data Call\n\r"); LCDPrintf(" 4 SMS\n\r"); LCDPrintf(" 9 Exit \n\r"); while(!Kbhit()); if(Kbhit()){ pkey=Getch(); if(pkey=='9') quit=1; else if(pkey=='1'){ clrLCD(); while(IsCom(2)){ buf=ReadCom(2); Print("%c",buf); if(buf!=13) LCDPrintf("%c",buf); if(buf==10){ DelayMs(1000); clrLCD(); } if(Kbhit()){ pkey=Getch(); if(pkey==27){ ClearCom(2); DelayMs(100); break; } } } } } } //Get_NMEA(2, "$GPGGA", nmea); /*Get whole $GPGGA code*/ //Get_Field(2, nmea, utc); /*Only Get UTC Time*/ // //LCDPrintf("\r\n%s",nmea); //LCDPrintf("\r\nUTC:%s",utc); DelayMs(1000); closeLCD(); RestoreCom2(); }