Mani Yuvan
Member level 1
- Joined
- Jan 18, 2015
- Messages
- 41
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Location
- Tamilnadu , India
- Activity points
- 321
when i connect gps with micro it works and display the letter but it shows
" $GPRMC,123519.09 " but i want extract the $GPGGA data.so how to i extract these data from gps
- - - Updated - - -
here below the code i attached. when i run this code in hardware the lcd display incorrectly.I also include the output pic also. please see and give the suggestion to me.
" $GPRMC,123519.09 " but i want extract the $GPGGA data.so how to i extract these data from gps
- - - Updated - - -
here below the code i attached. when i run this code in hardware the lcd display incorrectly.I also include the output pic also. please see and give the suggestion to me.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 #include<p18f452.h> #include"H:\RECovery RObot\header files\lcd.h" #include"H:\RECovery RObot\header files\delay.h" #include"H:\RECovery RObot\header files\motor.h" #pragma config OSC=HS, OSCS=OFF #pragma config DEBUG=OFF, LVP=OFF, STVR=OFF #pragma config WDT=OFF #pragma config BOR=OFF, PWRT=ON unsigned char rx_data(void); unsigned char longi_data[12]; unsigned char lati_data[12]; unsigned char data; void main() { unsigned char a[]={0X38,0X01,0X0c,0X06,0X80},i; TRISD=0; ADCON1=0X07; TRISEbits.TRISE0=0; TRISEbits.TRISE1=0; TRISEbits.TRISE2=0; //TRISC=0; en=0; for(i=0;i<5;i++) { lcdcmd(a[i]); Msdelay(2); } RCSTA=0X90; SPBRG=129; // Fill SPBRG register to set the baud rate TXSTAbits.TXEN=1; RCSTAbits.SPEN=1; while(1) { data=rx_data(); // Check the string '$GPGGA,' if(data=='$') { data=rx_data(); if(data=='G') { data=rx_data(); if(data=='P'); { data=rx_data(); if(data=='G'); { data=rx_data(); if(data=='G') { data=rx_data(); if(data=='A') { data=rx_data(); if(data==',') { data=rx_data(); while(data!=',') data=rx_data(); if(data==',') { for(i=0;data!='N';i++) { data=rx_data(); lati_data[i]=data; // Store the Latitude data } } data=rx_data(); if(data==',') { for(i=0;data!='E';i++) { data=rx_data(); longi_data[i]=data; // Store the Longitude data } } i=0; while(i<11) { lcddata(lati_data[i]); // Print the Latitude data Msdelay(2); i++; } i=0; lcdcmd(0xc0); while(i<12) { lcddata(longi_data[i]); // Print the Longitude data Msdelay(2); i++; } } } } } } } } } Msdelay(1000); for(i=0;i<12;i++) { data=0; lati_data[i]=0; longi_data[i]=0; } } unsigned char rx_data(void) { while(PIR1bits.RCIF==0); // Wait until RCIF gets low return RCREG; // Store data in Reception register }#include<p18f452.h> #include"H:\RECovery RObot\header files\lcd.h" #include"H:\RECovery RObot\header files\delay.h" #include"H:\RECovery RObot\header files\motor.h" #pragma config OSC=HS, OSCS=OFF #pragma config DEBUG=OFF, LVP=OFF, STVR=OFF #pragma config WDT=OFF #pragma config BOR=OFF, PWRT=ON unsigned char rx_data(void); unsigned char longi_data[12]; unsigned char lati_data[12]; unsigned char data; void main() { unsigned char a[]={0X38,0X01,0X0c,0X06,0X80},i; TRISD=0; ADCON1=0X07; TRISEbits.TRISE0=0; TRISEbits.TRISE1=0; TRISEbits.TRISE2=0; //TRISC=0; en=0; for(i=0;i<5;i++) { lcdcmd(a[i]); Msdelay(2); } RCSTA=0X90; SPBRG=129; // Fill SPBRG register to set the baud rate TXSTAbits.TXEN=1; RCSTAbits.SPEN=1; while(1) { data=rx_data(); // Check the string '$GPGGA,' if(data=='$') { data=rx_data(); if(data=='G') { data=rx_data(); if(data=='P'); { data=rx_data(); if(data=='G'); { data=rx_data(); if(data=='G') { data=rx_data(); if(data=='A') { data=rx_data(); if(data==',') { data=rx_data(); while(data!=',') data=rx_data(); if(data==',') { for(i=0;data!='N';i++) { data=rx_data(); lati_data[i]=data; // Store the Latitude data } } data=rx_data(); if(data==',') { for(i=0;data!='E';i++) { data=rx_data(); longi_data[i]=data; // Store the Longitude data } } i=0; while(i<11) { lcddata(lati_data[i]); // Print the Latitude data Msdelay(2); i++; } i=0; lcdcmd(0xc0); while(i<12) { lcddata(longi_data[i]); // Print the Longitude data Msdelay(2); i++; } } } } } } } } } Msdelay(1000); for(i=0;i<12;i++) { data=0; lati_data[i]=0; longi_data[i]=0; } } unsigned char rx_data(void) { while(PIR1bits.RCIF==0); // Wait until RCIF gets low return RCREG; // Store data in Reception register }