Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 //GPS GT-720F Test05 00002 #include "mbed.h" 00003 #include "TextLCD0420.h" 00004 00005 #define ON 1 00006 #define OFF 0 00007 00008 DigitalOut mled0(LED1); 00009 DigitalOut mled1(LED2); 00010 00011 TextLCD lcd(p24, p25, p26, p27, p28, p29, p30,20,4); // rs, rw, e, d0, d1, d2, d3 00012 Serial gps(p9,p10); 00013 00014 int main() { 00015 00016 char c; 00017 int i,rlock,stn; 00018 char gps_data[256]; 00019 char ns,ew; 00020 float time,hokui,tokei; 00021 float g_hokui,g_tokei; 00022 float d_hokui,m_hokui,d_tokei,m_tokei; 00023 00024 gps.baud(9600); 00025 lcd.cls(); 00026 lcd.locate(0,0); 00027 lcd.printf("*** GPS GT-720F ***"); 00028 00029 while (1) { 00030 i=0; 00031 while(gps.getc()!='$'){ 00032 } 00033 00034 while( (gps_data[i]=gps.getc()) != '\r'){ 00035 i++; 00036 if(i==256){ 00037 lcd.printf("*** Data read Error! ***\n"); 00038 i=255; 00039 break; 00040 } 00041 } 00042 gps_data[i]='\0'; 00043 00044 //test 00045 /* Test data 00046 rlock=1; 00047 hokui=3532.25024; //=>35.537502 00048 tokei=13751.86820;//=>137.864471 00049 */ 00050 if( sscanf(gps_data, "GPGGA,%f,%f,%c,%f,%c,%d,%d",&time,&hokui,&ns,&tokei,&ew,&rlock,&stn) >= 1){ 00051 if(rlock >= 1){ 00052 //hokui 00053 d_hokui=int(hokui/100); 00054 m_hokui=(hokui-d_hokui*100)/60; 00055 g_hokui=d_hokui+m_hokui; 00056 //tokei 00057 d_tokei=int(tokei/100); 00058 m_tokei=(tokei-d_tokei*100)/60; 00059 g_tokei=d_tokei+m_tokei; 00060 //g_hokui=int(hokui/100)+(hokui-int(hokui/100))/60; 00061 //g_tokei=int(tokei/100)+(tokei-int(tokei/100))/60; 00062 00063 lcd.cls(); 00064 lcd.locate(0,0); 00065 lcd.printf("*** GPS GT-720F ***"); 00066 lcd.locate(0,1); 00067 lcd.printf("Lock(%d),Stn(%d)",rlock,stn); 00068 //Latitude=Hokui 00069 lcd.locate(0,2); 00070 lcd.printf("Lat/dd:%4.6f",g_hokui); 00071 // Logitude=tokei 00072 lcd.locate(0,3); 00073 lcd.printf("Log/dd:%4.6f",g_tokei); 00074 } 00075 else{ 00076 lcd.locate(0,1); 00077 lcd.printf("Lock(%d),Stn(%d)",rlock,stn); 00078 lcd.locate(0,2); 00079 for(i=0;i<40;i++){ 00080 lcd.printf("%c",gps_data[i]); 00081 } 00082 } 00083 }//if 00084 }//while 00085 }//main 00086 00087 00088
Generated on Mon Jul 18 2022 02:37:14 by
1.7.2