Estou tentando tratar os dados que o GPS envia pela serial, mas estou com algumas duvidas:
- Código: Selecionar todos
strcpy(gpsread,"$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47");
if (strcmp(gpsread[0],'$')==0){// Ler dados que iniciem com '$'
output_bit(LED_GPS,1);
strncpy(gptip,strchr (strchr (gpsread,'P'),'G'),3);// verifica o tipo de mensagem, ex.: GGA
strcpy(gga_data,strtok (strchr (gpsread,','),'*'));
lcd_pos_xy(1,1);printf(escreve_lcd,"LAT: %s",gga_lat);
lcd_pos_xy(1,2);printf(escreve_lcd,"LON: %s",gga_lon);
onde 'gpsread' é o dado do GPS, coloquei um valor fixo para poder testar, por exemplo como irei ler somente a latude e a longtude sendo que o padrão para o tipo GGA é:
- GGA - essential fix data which provide 3D location and accuracy data.
$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
Where:
GGA Global Positioning System Fix Data
123519 Fix taken at 12:35:19 UTC
4807.038,N Latitude 48 deg 07.038' N
01131.000,E Longitude 11 deg 31.000' E
1 Fix quality: 0 = invalid
1 = GPS fix (SPS)
2 = DGPS fix
3 = PPS fix
4 = Real Time Kinematic
5 = Float RTK
6 = estimated (dead reckoning) (2.3 feature)
7 = Manual input mode
8 = Simulation mode
08 Number of satellites being tracked
0.9 Horizontal dilution of position
545.4,M Altitude, Meters, above mean sea level
46.9,M Height of geoid (mean sea level) above WGS84
ellipsoid
(empty field) time in seconds since last DGPS update
(empty field) DGPS station ID number
*47 the checksum data, always begins with *
Obrigado pela atenção...