// "Texto" es la variable que contiene el string con la sentencia NMEA del tipo:
// $GPGGA,235947.000,0000.0000,N,00000.0000,E,0,00,0.0,0.0,M,,,,0000*00
// $GPGGA,092204.999,4250.5589,S,14718.5084,E,1,04,24.4,19.7,M,,,,0000*1F
// etc...
************************************************************** SENTENCIAS NMEA
*----------------------------------------------------------------- Seleccion()
function Seleccion(Texto)
do case
case left(Texto,7)="$GPGGA,"
ComandoGGA(Texto)
case left(Texto,7)="$GPGSA,"
ComandoGSA(Texto)
case left(Texto,7)="$GPGSV,"
ComandoGSV(Texto)
case left(Texto,7)="$GPRMC,"
ComandoRMC(Texto)
case left(Texto,7)="$GPVTG,"
ComandoVTG(Texto)
otherwise
ComandoOTROS(Texto)
endcase
return nil
*-------------------------------------------------------------- ComandoOTROS()
function ComandoOTROS(Texto)
if Texto=""
return nil
endif
Texto:=substr(Texto,8)
return nil
*---------------------------------------------------------------- ComandoGGA()
function ComandoGGA(Texto) && Global positioning system fixed data
* $GPGGA Sentence (Fix data)
* Ejemplos $GPGGA,235947.000,0000.0000,N,00000.0000,E,0,00,0.0,0.0,M,,,,0000*00
* $GPGGA,092204.999,4250.5589,S,14718.5084,E,1,04,24.4,19.7,M,,,,0000*1F
* ID $GPGGA
* Hora UTC Time 092204.999 hhmmss.sss
* Latitud 4250.5589 ddmm.mmmm
* Indicador N/S N=Norte, S=Sur
* Longitud 14718.5084 dddmm.mmmm
* Indicador E/W E=Este, W=Oeste
* Posicion fijada 0=Invalido, 1=Valido SPS, 2=Valido DGPS, 3=Valido PPS
* Satelites Vistos (0-12)
* Horizontal dilution of precision(HDOP)
* Altura en metros segun elipsoide WGS84
* Unidades altura M=metros
* Separacion geoide en metros segun elipsoide WGS84
* Unidades separación M=Metros
* Antigüedad de los datos DGPS en segundos
* ID estacion DGPS
* Checksum
* Terminador CR/LF
*---
if Texto=""
return nil
endif
Texto:=substr(Texto,8)
*--- Hora (hhmmss.sss)
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGGAhora:=left(cCampo,2)+":"+substr(cCampo,3,2)+":"+substr(cCampo,5,6)
*--- Latitud (ggmm.mmmm)
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGGAlat:=left(cCampo,2)+"º"+substr(cCampo,3,2)+"'"+str((val(substr(cCampo,6,4))/10000)*60,6,3)
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGGAlatNS:=cCampo
*--- Longitud (gggmm.mmmm)
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGGAlon:=left(cCampo,3)+"º"+substr(cCampo,4,2)+"'"+str((val(substr(cCampo,7,4))/10000)*60,6,3)
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGGAlonEW:=cCampo
*--- Posicion fijada
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGGAfix:=cCampo
*--- Satelites Vistos
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGGAsat:=cCampo
*--- Horizontal dilution of precision(HDOP)
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGGAhdop:=cCampo
*--- Altura en metros segun elipsoide WGS84
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGGAalt:=cCampo
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGGAualt:=cCampo
*--- Separacion geoide en metros segun elipsoide WGS84
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGGAsep:=cCampo
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGGAusep:=cCampo
*--- Antigüedad de los datos DGPS en segundos
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGGAseg:=cCampo
*--- ID estacion DGPS
cCampo:=left(Texto,at("*",Texto)-1)
Texto:=substr(Texto,at("*",Texto)+1)
cGGAdgps:=cCampo
*--- Checksum
cGGAcheck:=left(Texto,2)
*---
return nil
*---------------------------------------------------------------- ComandoGSA()
function ComandoGSA(Texto) && GNSS DOP and active satellites
* $GPGSA Sentence (Active satellites)
* Ejemplos:$GPGSA,A,1,,,,,,,,,,,,,0.0,0.0,0.0*30
* $GPGSA,A,3,01,20,19,13,,,,,,,,,40.4,24.4,32.2*0A
* ID $GPGSA
* Mode A=Auto 2D/3D, M=Forced 2D/3D
* Mode 1=No fix, 2=2D, 3=3D
* Satelite en uso 1
* Satelite en uso 2
* Satelite en uso 3
* Satelite en uso 12
* PDOP Position dilution of precision
* HDOP Horizontal dilution of precision
* VDOP Vertical dilution of precision
* Checksum
* Terminator CR/LF
*---
if Texto=""
return nil
endif
Texto:=substr(Texto,8)
*--- Mode 1
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSAmode1:=cCampo
*--- Mode 2
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSAmode2:=cCampo
*--- Satelite en uso 1-12
for Indice=1 to 12
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSAsat[Indice]:=cCampo
next Indice
*--- PDOP Position dilution of precision
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSApdop:=cCampo
*--- HDOP Horizontal dilution of precision
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSAhdop:=cCampo
*--- VDOP Vertical dilution of precision
cCampo:=left(Texto,at("*",Texto)-1)
Texto:=substr(Texto,at("*",Texto)+1)
cGSAvdop:=cCampo
*--- Checksum
cGSAcheck:=left(Texto,2)
*---
return nil
*---------------------------------------------------------------- ComandoGSV()
function ComandoGSV(Texto) && GNSS satellites in view
* $GPGSV Sentence (Satellites in view)
* Ejemplos: $GPGSV,1,1,01,21,00,000,*4B
* $GPGSV,3,1,10,20,78,331,45,01,59,235,47,22,41,069,,13,32,252,45*70
* ID $GPGSV
* Number of messages 3 Number of messages in complete message (1-3)
* Sequence number, Sequence number of this entry (1-3)
* Satellites in view
* Satellite ID 1 Range is 1-32
* Elevation 1 Elevation in degrees (0-90)
* Azimuth 1 Azimuth in degrees (0-359)
* SNR 1 Signal to noise ration in dBHZ (0-99)
* Satellite ID 2 Range is 1-32
* Elevation 2 Elevation in degrees (0-90)
* Azimuth 2 Azimuth in degrees (0-359)
* SNR 2 Signal to noise ration in dBHZ (0-99)
* Satellite ID 3 Range is 1-32
* Elevation 3 Elevation in degrees (0-90)
* Azimuth 3 Azimuth in degrees (0-359)
* SNR 3 Signal to noise ration in dBHZ (0-99)
* Satellite ID 4 Range is 1-32
* Elevation 4 Elevation in degrees (0-90)
* Azimuth 4 Azimuth in degrees (0-359)
* SNR 4 Signal to noise ration in dBHZ (0-99)
* Checksum
* Terminator CR/LF
*---
if Texto=""
return nil
endif
*--- Number of messages
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVnum:=cCampo
*--- Sequence number
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVorden:=cCampo
*---
if cGSVorden="1"
afill(nGanSat,0)
endif
*---
nOffSet:=iif(cGSVorden="1",0,iif(cGSVorden="2",4,iif(cGSVorden="3",8,0)))
*--- Satellites in view
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVsat:=cCampo
*--- Satellite ID 1
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVid1:=cCampo
*--- Elevation 1
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVelev1:=cCampo
*--- Azimuth 1
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVaci1:=cCampo
*--- SNR 1
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVdbhz1:=cCampo
*--- Satellite ID 2
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVid2:=cCampo
*--- Elevation 2
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVelev2:=cCampo
*--- Azimuth 2
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVaci2:=cCampo
*--- SNR 2
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVdbhz2:=cCampo
*--- Satellite ID 3
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVid3:=cCampo
*--- Elevation 3
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVelev3:=cCampo
*--- Azimuth 3
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVaci3:=cCampo
*--- SNR 3
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVdbhz3:=cCampo
*--- Satellite ID 4
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVid4:=cCampo
*--- Elevation 4
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVelev4:=cCampo
*--- Azimuth 4
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cGSVaci4:=cCampo
*--- SNR 4
cCampo:=left(Texto,at("*",Texto)-1)
Texto:=substr(Texto,at("*",Texto)+1)
cGSVdbhz4:=cCampo
*--- Checksum
cGSVcheck:=left(Texto,2)
*---
nGanSat[val(cGSVid1)+1]:=val(cGSVdbhz1)
nGanSat[val(cGSVid2)+1]:=val(cGSVdbhz2)
nGanSat[val(cGSVid3)+1]:=val(cGSVdbhz3)
nGanSat[val(cGSVid4)+1]:=val(cGSVdbhz4)
*---
return nil
*---------------------------------------------------------------- ComandoRMC()
function ComandoRMC(Texto) && Recommended minimum specific GNSS data
* $GPRMC Sentence (Position and time)
* Ejemplos $GPRMC,235947.000,V,0000.0000,N,00000.0000,E,,,041299,,*1D
* $GPRMC,092204.999,A,4250.5589,S,14718.5084,E,0.00,89.68,211200,020.3,E*25
* ID $GPRMC
* Hora UTC 092204.999 hhmmss.sss
* Status A A = Valido, V = Invalido
* Latitud 4250.5589 ggmm.mmmm
* Indicador N/S N=Norte, S=Sur
* Longitud 14718.5084 gggmm.mmmm
* Indicador E/W E=Este, W=Oeste
* Velocidad respecto del suelo 0.00 nudos (1nudo=1854mts)
* Rumbo sobre el suelo 0.00 Grados
* Día UTC 211200 DDMMAA
* Magnetic variation 020.3 Grados
* Magnetic variation E=Este, W=Oeste
* Checksum
* Terminador CR/LF
*---
if Texto=""
return nil
endif
Texto:=substr(Texto,8)
*--- Hora (hhmmss.sss)
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cRMChora:=left(cCampo,2)+":"+substr(cCampo,3,2)+":"+substr(cCampo,5,6)
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cRMCstatus:=cCampo
*--- Latitud (ggmm.mmmm)
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cRMClat:=left(cCampo,2)+"º"+substr(cCampo,3,2)+"'"+str((val(substr(cCampo,6,4))/10000)*60,6,3)
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cRMClatNS:=cCampo
*--- Longitud (gggmm.mmmm)
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cRMClon:=left(cCampo,3)+"º"+substr(cCampo,4,2)+"'"+str((val(substr(cCampo,7,4))/10000)*60,6,3)
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cRMClonEW:=cCampo
*--- Velocidad
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cRMCvelo:=cCampo
*--- Rumbo
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cRMCrumbo:=cCampo
*--- Día DDMMAA
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cRMCdia:=left(cCampo,2)+"/"+cTxtMeses[val(substr(cCampo,3,2))]+"/"+substr(cCampo,5,2)
*--- Declinación magnetica
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cRMCdecli:=cCampo
cCampo:=left(Texto,at("*",Texto)-1)
Texto:=substr(Texto,at("*",Texto)+1)
cRMCdecliEW:=cCampo
*--- Checksum
cRMCcheck:=left(Texto,2)
*---
return nil
*---------------------------------------------------------------- ComandoVTG()
function ComandoVTG(Texto) && Course over ground and ground speed
* $GPVTG Sentence (Course over ground)
* Ejemplos: $GPVTG,,T,,M,,N,,K*4E
* $GPVTG,89.68,T,,M,0.00,N,0.0,K*5F
* Sentence ID $GPVTG
* Course Course in degrees
* Reference T = True heading
* Course Course in degrees
* Reference M=Magnetic heading
* Speed 0.00 Horizontal speed
* Units N N=Knots
* Speed 0.00 Horizontal speed
* Units K K=KM/h
* Mode indicator (A=Autonomous, D=Differential, E=Estimated, N=Data not valid)
* Checksum
* Terminator CR/LF
*---
if Texto=""
return nil
endif
Texto:=substr(Texto,8)
*--- Course
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cVTGrumbT:=cCampo
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cVTGrefT:=cCampo
*--- Course
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cVTGrumbM:=cCampo
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cVTGrefM:=cCampo
*--- Speed
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cVTGvelN:=cCampo
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cVTGunitN:=cCampo
*--- Speed
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cVTGvelK:=cCampo
cCampo:=left(Texto,at(",",Texto)-1)
Texto:=substr(Texto,at(",",Texto)+1)
cVTGunitK:=cCampo
*--- Mode indicator
cCampo:=left(Texto,at("*",Texto)-1)
Texto:=substr(Texto,at("*",Texto)+1)
cVTGmode:=cCampo
*--- Checksum
cVTGcheck:=left(Texto,2)
*---
return nil
*------------------------------------------------------------ Otras sentencias
* $GPGLL,4916.45,N,12311.12,W,225444,A*23 && Geographic position - latitude / longitude
* 4916.46,N Latitude 49 deg. 16.45 min. North
* 12311.12,W Longitude 123 deg. 11.12 min. West
* 225444 Fix taken at 22:54:44 UTC
* A Data valid or V (void)
* *23 checksum data
*---
* $GPAPB,A,A,0.10,R,N,V,V,011,M,DEST,011,M,011,M*82*23 && Autopilot format "B"
* A Loran-C blink/SNR warning, general warning
* A Loran-C cycle warning
* 0.10 cross-track error distance
* R steer Right to correct (or L for Left)
* N cross-track error units - nautical miles (K for kilometers)
* V arrival alarm - circle
* V arrival alarm - perpendicular
* 011,M magnetic bearing, origin to destination
* DEST destination waypoint ID
* 011,M magnetic bearing, present position to destination
* 011,M magnetic heading to steer (bearings could True as 033,T)
* *23 checksum data
*---
* $GPBWC,225444,4917.24,N,12309.57,W,051.9,T,031.6,M,001.3,N,004*29 && Bearing and Distance to Waypoint, Great Circle
* 225444 UTC time of fix 22:54:44
* 4917.24,N Latitude of waypoint
* 12309.57,W Longitude of waypoint
* 051.9,T Bearing to waypoint, degrees true
* 031.6,M Bearing to waypoint, degrees magnetic
* 001.3,N Distance to waypoint, Nautical miles
* 004 Waypoint ID
* *29 checksum
*---
* $GPXTE,A,A,0.67,L,N*07 && Cross-Track Error, Measured
* A General warning flag V = warning
* (Loran-C Blink or SNR warning)
* A Not used for GPS (Loran-C cycle lock flag)
* 0.67 cross track error distance
* L Steer left to correct error (or R for right)
* N Distance units - Nautical miles
* *07 checksum
*---
* $GPHDT,056.2,T*07 && Heading True
* Actual vessel heading in degrees Ture produced by any device or system producing true heading.
* x.x Heading, degrees True
* T = True
* *07 checksum
*---
* $GPHDM,056.2,M*07 && Heading magnetic
* x.x Heading, degrees magnetic
* M = Magnetic
* *07 checksum
*---
* $GPVWR,040,L,10.0,N,00.0,M,00.0,K*07 && Relative wind direction and speed
*
*------------------------------------------------------ NUEVAS DE GARMIN GPS12
* $GPBOD,045.,T,023.,M,DEST,STRAT,*47 && Bearing, origin to destination
* 045.,T bearing 045 degrees True from "START" to "DEST"
* 023.,M breaing 023 degrees Magnetic from "START" to "DEST"
* DEST destination waypoint ID
* STRAT origin waypoint ID
* *47 checksum
*---
* $GPRTE,1,1,c,0*07 && Routes
* $GPRTE,2,1,c,0,PBRCPK,PBRTO,PTELGR,PPLAND,PYAMBU,PPFAIR,PWARRN*73 && Routes
* $GPRTE,2,2,c,0,PCRESY,GRYRIE,GCORIO,GWERR,GWESTG,7FED*34
* 1 2 3 4 5 ..
* Number of sentences in sequence
* Sentence number
* 'c' = Current active route, 'w' = waypoint list starts with destination waypoint
* Name or number of the active route
* onwards, Names of waypoints in Route
*---
* $GPRMB,A,0.66,L,003,004,4917.24,N,12309.57,W,001.3,052.5,000.5,V*0B && Recommended minimum navigation info
* A Data status A = OK, V = warning
* 0.66,L Cross-track error (nautical miles, 9.9 max.), steer Left to correct (or R = right)
* 003 Origin waypoint ID
* 004 Destination waypoint ID
* 4917.24,N Destination waypoint latitude 49 deg. 17.24 min. N
* 12309.57,W Destination waypoint longitude 123 deg. 09.57 min. W
* 001.3 Range to destination, nautical miles
* 052.5 True bearing to destination
* 000.5 Velocity towards destination, knots
* V Arrival alarm A = arrived, V = not arrived
* *0B checksum
*---
* $PGRME,15.0,M,45.0,M,25.0,M*22 && Estimated Position Error (solo Garmin)
* 15.0,M Estimated horizontal position error in metres (HPE)
* 45.0,M Estimated vertical error (VPE) in metres
* 25.0,M Overall spherical equivalent position error
* *22 checksum
*---
* $PGRMZ,93,f,3*21 && Altitude Information
* 93,f Altitude in feet (f=feet)
* 3 Position fix dimensions 2=user altitude, 3=GPS altitude
* This sentence shows in feet, regardless of units shown on the display.
*---
* $PGRMM,WGS 84*06 && Map Datum (solo Garmin)
* $PGRMM,Astrln Geod '66*51
* $PGRMM,NAD27 Canada*2F
* Currently active horizontal datum
*---
* $PSLIB && Control de baliza receptora (solo Garmin)
* Las correcciones de DGPS se aceptan en formato RTCM-104 versión 2.1
*---
* $GPR00,EGLL,EGLM,EGTB,EGUB,EGTK,MBOT,EGTB,,,,,,,*58 && List of waypoint IDs in currently active route
* List of waypoints. This alternates with $GPWPL cycle which itself cycles waypoints.
*---
* $GPWPL,4917.16,N,12310.64,W,003*65 && Waypoint location
* 4917.16,N Latitude of waypoint
* 12310.64,W Longitude of waypoint
* 003 Waypoint ID
* When a route is active, this sentence is sent once for each
* waypoint in the route, in sequence. When all waypoints have
* been reported, GPR00 is sent in the next data set. In any
* group of sentences, only one WPL sentence, or an R00
* sentence, will be sent.
*-----------------------------------------------------------------------------