GPS NMEA problems

Started by "guntis.laurins" March 4, 2008
> ...How Can I disable NMEA sentences in Garmin etrex...

I no longer have a functioning eTrex after disassembling the thing when
the LCD failed so I cannot test one for you, but I cannot find any
Internet reference to selectable NMEA sentences from any eTrex model.
Tom
--- In b..., "guntis.laurins"
wrote:
>
> --- In b..., Tom Becker wrote:
> >
> > > ...How Can I disable NMEA sentences in Garmin etrex...
> >
> > I no longer have a functioning eTrex after disassembling the thing
when
> > the LCD failed so I cannot test one for you, but I cannot find any
> > Internet reference to selectable NMEA sentences from any eTrex model.
> >
> >
> > Tom
> >
> 1. is There any software for selectable NMEA sentences ???
>
> 2. can You send me compiled Project with DateTimeNMEA.bas,
> Serial_24.bas and Support_24.bas , Maybe I did something simple and
> stupid wrong in my project, what I sent to You ???
>
and what is the maximum Number for
private const InBufSize_3 as INTEGER = 13 ' 4-byte buffer.

You sad That I can put there 20, but if also with that commas is
mising ???
> .... is there any software for selectable NMEA sentences ?

Some Garmin products are based on common GPS chipsets like those from
SiRF. I do not know if the eTrex is one of them or if it is a
Garmin-proprietary. One utility that can change the options in SiRF
chipsets is SiRFDemo: http://www.sirf.com/free_demo.html . There are
several other common GPS chipset manufacturers, though, so you might
need to do some research to identify what your receiver uses.

If you find that you have a SiRF-based receiver, you might find Paul's
GPS_Example.bas

code useful:
http://tech.groups.yahoo.com/group/basicx/files/Datasheets-Appnotes-Examples-Drawings/Comm/GPS/

I've sent you a private email with a compiled project that should work -
but I can't test it here since I don't have an eTrex. Because you have
a GPS lab at your school, perhaps better equipped than my own, I
encourage you to find local assistance. I wish you good fortune.
Tom
--- In b..., Tom Becker wrote:
>
> > .... is there any software for selectable NMEA sentences ?
>
> Some Garmin products are based on common GPS chipsets like those from
> SiRF. I do not know if the eTrex is one of them or if it is a
> Garmin-proprietary. One utility that can change the options in SiRF
> chipsets is SiRFDemo: http://www.sirf.com/free_demo.html . There are
> several other common GPS chipset manufacturers, though, so you might
> need to do some research to identify what your receiver uses.
>
> If you find that you have a SiRF-based receiver, you might find Paul's
> GPS_Example.bas
>


> code useful:
>
http://tech.groups.yahoo.com/group/basicx/files/Datasheets-Appnotes-Examples-Drawings/Comm/GPS/
>
> I've sent you a private email with a compiled project that should
work -
> but I can't test it here since I don't have an eTrex. Because you have
> a GPS lab at your school, perhaps better equipped than my own, I
> encourage you to find local assistance. I wish you good fortune.
> Tom
>
Thanks Tom I will try :)
--- In b..., Tom Becker wrote:
>
> > ...How Can I disable NMEA sentences in Garmin etrex...
>
> I no longer have a functioning eTrex after disassembling the thing when
> the LCD failed so I cannot test one for you, but I cannot find any
> Internet reference to selectable NMEA sentences from any eTrex model.
> Tom
>
1. is There any software for selectable NMEA sentences ???

2. can You send me compiled Project with DateTimeNMEA.bas,
Serial_24.bas and Support_24.bas , Maybe I did something simple and
stupid wrong in my project, what I sent to You ???
--- In b..., "guntis.laurins"
wrote:
>
> --- In b..., Tom Becker wrote:
> >
> > > .... is there any software for selectable NMEA sentences ?
> >
> > Some Garmin products are based on common GPS chipsets like those from
> > SiRF. I do not know if the eTrex is one of them or if it is a
> > Garmin-proprietary. One utility that can change the options in SiRF
> > chipsets is SiRFDemo: http://www.sirf.com/free_demo.html . There are
> > several other common GPS chipset manufacturers, though, so you might
> > need to do some research to identify what your receiver uses.
> >
> > If you find that you have a SiRF-based receiver, you might find
Paul's
> > GPS_Example.bas
> > code useful:
> http://tech.groups.yahoo.com/group/basicx/files/Datasheets-Appnotes-Examples-Drawings/Comm/GPS/
> >
> > I've sent you a private email with a compiled project that should
> work -
> > but I can't test it here since I don't have an eTrex. Because you
have
> > a GPS lab at your school, perhaps better equipped than my own, I
> > encourage you to find local assistance. I wish you good fortune.
> >
> >
> > Tom
> >
> Thanks Tom I will try :)
>
Yee.. Finaly everything works :) With your Projekt Tom, data was the
same, 1999-01-01 00:00:01, but then I test Your example on onother
Basicx24 and now time is 2008-03 .... I belive that problem was in my
BX24 hardware.

Thanks You all :) This forum is great :) !!!
> ... Finally, everything works. :)

Great. Glad you got it working!
Tom
Hello,
I am having some issues with this code myself. I am trying to read in
2 NMEA sentences of which are the RMC and the GGA sentences. I am
using a Garmin GPS 18 LVC and it is configured to send out only these
two sentences. My issue is that it is not giving me the altitude
correctly. This is the only thing i am using from the GGA sentence.
Since altitude is not sent with leading zeros, and it could go up to
7 characters long, i have had to implement some variables for
decoding it. I also implemented a way to store, upload and clear the
data since we will be recording the placement of the balloon sat so
we can reference our two experiments to lat, long, time and altitude
(snipets from other codes). When we ran the original code we got back
some weird data as in the altitude never changed although we were
testing by driving around, up and down as the road led us. If there
is another way to do this, any advice is well appreciated.

Modified code from NMEA GPS:
' uses Serialport_24.bas and Support_24.bas
dim bChecksum as byte, bRawChecksum(1 to 2) as byte

dim iYear as integer, bMonth as byte, bDay as byte
dim bHour as byte, bMin as byte, sSec as single
dim bSec as byte, strX as string*3, strY as string*3, strZ as
string*3
'SoS
Dim Tx As String, Range As Single, NoEcho As Boolean
'Dim SoSSuccess As Boolean
Dim A as Integer
'Dim B as Integer
'Dim AvgTime as Single

'Memory
Dim Current_EEPROM_Address As Long
Dim Last_EEPROM_Address as Long
Const EEPROM_Start_Address As Long = 10000
Const EEPROM_End_Address As Long = 30000

'GPS
dim qChar as string * 1

dim Success as boolean
dim bUTCDate(1 to 6) as byte
dim bUTCTime(1 to 6) as byte
dim bNMEA_Cmd(1 to 5) as byte
const lInSpeed as long = 4800
dim tfValid as boolean
dim velValid as boolean
dim bLatdeg as byte, bLatMin as byte, bLatMinDeg as byte,
bLatMinS as byte, bLatMinSS as byte
dim bLondeg as byte, bLonMin as byte, bLonMinDeg as byte,
bLonMinS as byte, bLonMinSS as byte
dim bVelo as byte
dim bVelo2 as byte
dim bAlt2 as byte
dim bAlt as byte
dim bOldSec as byte
dim bSecGPS as Byte
Const Deg As Byte = 176 ' Degree symbol
dim bLatDM(1 to 9) as byte 'ddmm.mmmm
dim bLonDM(1 to 10) as byte 'dddmm.mmmm
dim bVelDM(1 to 5) as byte 'vvv.v
dim bAltDM(1 to 7) as byte 'aaaaa.a
Dim ElSize as integer
Dim ElSize2 as integer
'Pressure Sensor
Dim Voltage As Integer
Dim Volt as Single

'Pins
const bNMEAOutPin as byte = 0
Const UploadSwitchPin As Byte = 12 ' BX-24
Const InitPin As Byte = 13
'Yellow SOS
Const EchoPin As Byte = 14 'BLue
SOS
const PressurePinNumber as Byte = 16
'PressureSensor
const bNMEAInPin as byte = 18 'GPS pin
(GPSoutput, BXinput)

Const LEDon As Byte = 0
Const LEDoff As Byte = 1
option explicit

'---------------------------------
----------

Sub Main()

Const SwitchClosed As Byte = 0

If (FirstTime) Then
' Uncomment these lines to clear the block of EEPROM
memory.
' Call ClearMemoryBlock(EEPROM_Start_Address,
EEPROM_End_Address)
' Exit Sub
' Debug.print "First time"
Current_EEPROM_Address = EEPROM_Start_Address
Else
Current_EEPROM_Address = Last_EEPROM_Address
debug.print "last address"
End If

' If (GetPin(UploadSwitchPin) = SwitchClosed) Then
' Call UploadData(EEPROM_Start_Address, EEPROM_End_Address)
' Else
call OpenNMEAin(lInSpeed) 'input

do
Last_EEPROM_Address = Current_EEPROM_Address
call PutPin(GreenLEDpin, LEDOn)
'Get Data from experiments
Call GetData
call delay(0.1)
'Get GPS data
call GetNMEA
Call Delay(0.1)
call GetNMEA2

' Call Delay(0.1)
' call DisplayData
'Save Data
If(Current_EEPROM_Address >EEPROM_End_Address) Then
'out of storage space
Exit Sub
Else
Call SaveData
End If
call PutPin(GreenLEDpin, LEDOff)
call PutPin(RedLEDpin, LEDon)
Call Delay(7.0) 'adjust this for delays in
samples
Call PutPin(RedLEDpin, LEDoff)
loop

' End If

End Sub
'---------------------------------
----------

Sub DisplayData()

'Display RTC date and time once per second

call GetTimestamp(iYear, bMonth, bDay, bHour, bMin, sSec)
bSec=fixb(sSec)
if bSec <> bOldSec then
call PutPin(17, 0)
call PutPin(17, 1)

bOldSec=bSec
' call PutPin(GreenLEDpin, LEDOn)

strX=cstr(cint(bMonth)+100)
strY=cstr(cint(bDay)+100)
debug.Print cstr(cint(iYear));"-";mid(strX,2,2);"-
";mid(strY,2,2);" ";

strX=cstr(cint(bHour)+100)
strY=cstr(cint(bMin)+100)
strZ=cstr(cint(bSec)+100)
debug.Print mid(strX,2,2);":";mid(strY,2,2);":";mid
(strZ,2,2)
end if

'GPS
Debug.Print " LatD: "; CStr(bLatDeg); chr(deg)
Debug.print " LatM: "; CStr(bLatMin); "." ;CStr
(bLatMinS);cstr(bLatMinSS)
Debug.Print " LonD: "; CStr(bLonDeg); chr(deg)
Debug.Print " LonM: "; CStr(bLonMin); "." ;CStr
(bLonMinS); cstr(bLonMinSS)
Debug.Print " Vel: "; CStr(bVelo)
Debug.Print " Alt: "; CStr(bAlt)

'SoS display
If (A >= 3) Then
debug.Print "timeout"
Else
debug.print "Distance: "; Cstr(Range)
End If
'Pressure Sensor
Debug.print "Pressure: ";
debug.print Cstr(volt)

End Sub 'DisplayData

'---------------------------------
-------
Sub GetData()

'SoS
Call PutPin(EchoPin, bxInputTristate)
Call PutPin(InitPin, bxOutputLow)
Dim SoSSuccess As Boolean
Const SpeedOfSound As Single = 344.0 'm/s

A=0
SoSSuccess = False
Do While (SoSSuccess = False)
' If there is nothing detected by the device, NoEcho is set
to true.
' Otherwise NoEcho is false.

Dim EchoDelay As Single

' Trigger acoustic ping.
Call PutPin(InitPin, bxOutputHigh)

' Wait for echo/ measure how long a pin stays at logic
low (0)
Call RCtime(EchoPin, 0, EchoDelay)

' get ready for the next cycle by lowering the INIT
pin
' Call PutPin(InitPin, bxOutputLow)

' If we don't receive an echo, RCtime overflows and
returns 0.0.
If (EchoDelay = 0.0) Then
Range = 11.0
NoEcho = True
Else
Range = (EchoDelay /2.0) *
SpeedOfSound 'divide by 2 because time is doubled for time to target
and back.
NoEcho = False
End If

If (NoEcho) Then
A=A+1
Else
SoSSuccess = True
End If

If (A = 3) Then
SoSSuccess = True
End If
Call Delay(0.2)
Loop

'---------------------------------
' Pressure
Voltage=GetADC(PressurePinNumber)
volt=CSng(Voltage)
Call Delay(1.0)

End Sub 'GetData
'---------------------------------
----------

Sub OpenNMEAin(byval speed as long)

call DefineCom3(bNMEAInPin, bNMEAOutPin,
bx1000_1000) 'inverted, no parity, 8 bits.
call OpenSerialPort_3(speed)

End Sub

'---------------------------------
----------

Sub GetNMEA()

Dim bNMEAData As Byte, tfSuccess as boolean

'$GPRMC,192631,A,3443.2547,N,08638.5393,W,015.1,180.3,140308,002.6,W,A
*1D
call GetByte_3(bNMEAData,tfSuccess)
if (tfSuccess) Then
if bNMEAData=asc("$") then
bChecksum=0
call GetBytes(bNMEA_Cmd,5)
if (bNMEA_Cmd(1)=asc("G")) and (bNMEA_Cmd(2)
=asc("P")) and (bNMEA_Cmd(3)=asc("R")) and (bNMEA_Cmd(4)=asc("M"))
and (bNMEA_Cmd(5)=asc("C")) then
'case "GPRMC"
call SkipCommas(1)
call GetDigits(bUTCTime,6)
'get time item
call SkipCommas(1) 'discard 1
comma
call getValidity
call SkipCommas(1)
call GetDigits(bLatDM,9)
'get ddmm.mmmm
call SkipCommas(2)
call GetDigits(bLonDM,10)
'get dddmm.mmmm
call SkipCommas(2)
'comment this out for
no signal
call GetDigits(bVelDM,5)
'get vvv.v, 'comment this out for no signal
call SkipCommas(2)
'change this to 3 for
no signal normally 1
call GetDigits(bUTCDate,6)
'get date item

do
call GetBytes
(bRawChecksum,1) 'discard but checksum
loop until (bRawChecksum(1)
=asc("*"))
bChecksumhecksum xor
bRawChecksum(1) 'remove * from checksum
call GetChecksumBytes
(bRawChecksum,2)
call CalcNMEAChecksum
' if tfValid then 'data valid
'' Call PutPin
(RedLEDpin, LEDon)
' call SetDateTime 'set
local clock
' Call PutPin
(RedLEDpin, LEDoff)
' end if
end if
end if
end If
Call SetDateTime
Call Delay(0.1)
Call GPSData
End Sub

'---------------------------------
----------------
Sub GetNMEA2()
Dim bNMEAData As Byte, tfSuccess as boolean
call GetByte_3(bNMEAData,tfSuccess)
if (tfSuccess) Then
if bNMEAData=asc("$") then
bChecksum=0
call GetBytes(bNMEA_Cmd,5)
if (bNMEA_Cmd(1)=asc("G")) and (bNMEA_Cmd(2)
=asc("P")) and (bNMEA_Cmd(3)=asc("G")) and (bNMEA_Cmd(4)=asc("G"))
and (bNMEA_Cmd(5)=asc("A")) then
'case "GPGGA"
'$GPGGA,192631,3443.2547,N,08638.5393,W,1,05,2.9,192.4,M,-30.7,M,,*7A
call SkipCommas(9)
call GetDigits(bAltDM,7)
'get Altitude aaaaa.a possible 7 bytes
do
call GetBytes
(bRawChecksum,1) 'discard but checksum
loop until (bRawChecksum(1)
=asc("*"))
bChecksumhecksum xor
bRawChecksum(1) 'remove * from checksum
call GetChecksumBytes
(bRawChecksum,2)
call CalcNMEAChecksum
end if
end if
end If
Call GetALT
End Sub

'---------------------------------
----------

Sub CalcNMEAChecksum()

bRawChecksum(1)=bRawChecksum(1)-asc("0") '0-9
if bRawChecksum(1)>9 then
bRawChecksum(1)=bRawChecksum(1)-7 'A-F
end if

bRawChecksum(2)=bRawChecksum(2)-asc("0")
if bRawChecksum(2)>9 then
bRawChecksum(2)=bRawChecksum(2)-7
end if

if bChecksum<>bRawChecksum(1)*16+bRawChecksum(2) then
tfValid=true 'false
end if

End Sub

'---------------------------------
----------

Sub SkipCommas(byval i as byte)

Dim bNMEAData As Byte, tfSuccess as boolean
Do
do
call GetByte_3(bNMEAData,tfSuccess)
' if not(tfSuccess) then
' call DisplayData
' end if
loop until (tfSuccess)
bChecksumhecksum xor bNMEAData
if bNMEAData=asc(",") then
i=i-1
end if
Loop until i=0

End Sub

'---------------------------------
----------

Sub GetDigits(ByRef Item() as byte, ByVal length as integer)

Dim bNMEAData As Byte, i as integer, tfSuccess as boolean
for i=1 to length
do
call GetByte_3(bNMEAData,tfSuccess)
' if not(tfSuccess) then
' call DisplayData
' end if
loop until (tfSuccess)
bChecksumhecksum xor bNMEAData
Item(i)=bNMEAData-asc("0")
next

End Sub

'---------------------------------
----------

Sub GetBytes(ByRef Item() as byte, ByVal length as integer)

Dim bNMEAData As Byte, i as integer, tfSuccess as boolean

for i=1 to length
do
call GetByte_3(bNMEAData,tfSuccess)
' if not(tfSuccess) then
' call DisplayData
' end if
loop until (tfSuccess)
bChecksumhecksum xor bNMEAData
Item(i)=bNMEAData
next

End Sub

'---------------------------------
----------

Sub GetChecksumBytes(ByRef Item() as byte, ByVal length as integer)

Dim bNMEAData As Byte, i as integer, tfSuccess as boolean

for i=1 to length
do
call GetByte_3(bNMEAData,tfSuccess)
' if not(tfSuccess) then
' call DisplayData
' end if
loop until (tfSuccess)
Item(i)=bNMEAData
next

End Sub

'---------------------------------
----------

Sub getValidity()

Dim bNMEAData As Byte, tfSuccess as boolean

do
call GetByte_3(bNMEAData,tfSuccess)
' if not(tfSuccess) then
' call DisplayData
' end if
loop until (tfSuccess)
bChecksumhecksum xor bNMEAData
if bNMEAData=asc("A") then

tfValid=true
else
tfValid=true
'change to false
end if

End Sub

'---------------------------------
----------

Sub SetDateTime()

iYear 00+cint(bUTCDate(5)*10)+cint(bUTCDate(6))
bMonthte(bUTCDate(3))*10+cbyte(bUTCDate(4))
bDayte(bUTCDate(1))*10+cbyte(bUTCDate(2))

bHour=bUTCTime(1)*10+bUTCTime(2)
bMin=bUTCTime(3)*10+bUTCTime(4)
sSec=csng(bUTCTime(5)*10+bUTCTime(6))
bSecGPS=bUTCTime(5)*10+bUTCTIME(6)
if (iYear>2099) or (bMonth>12) or (bDay>31) or (bHour>23) or
(bMin>59) or (sSec>60.0) then
exit sub
end if

call PutTimestamp(iYear, bMonth, bDay, bHour, bMin, sSec)

End Sub

'---------------------------------
------------------------------
Sub GPSData()
bLatDegte(bLatDM(1))*10+cbyte(bLatDM(2))
bLatMinte(bLatDM(3))*10+cbyte(bLatDM(4))
bLatMinSte(bLatDM(6))*10+cbyte(bLatDM(7))
bLatMinSSte(bLatDM(8))*10+cbyte(bLatDM(9))

bLonDeg=(cbyte(bLonDM(1))*100)+(cbyte(bLonDM(2))*10)+cbyte
(bLonDM(3))
bLonMin=(cbyte(bLonDM(4))*10)+(cbyte(bLonDM(5)))
bLonMinS=(cbyte(bLonDM(7))*10)+(cbyte(bLonDM(8)))
bLonMinSS=(cbyte(bLonDM(9))*10)+(cbyte(bLonDM(10)))

bVelo=(cbyte(bVelDM(1))*100)+(cbyte(bVelDM(2))*10)+(cbyte
(bVelDM(3)))
bVelo2=(cbyte(bVelDM(5)))
End Sub
'---------------------------------
---------------------------
Sub GetAlt()
'$GPGGA,192631,3443.2547,N,08638.5393,W,1,05,2.9,192.4,M,-30.7,M,,*7A
' Since there is a possibility of 99999.9 being the altitude, we must
read in 7 bytes
' Since ground level will only have 5 bytes, we must decode the
altitude to check for
' commas. In order to save correctly, we must add in an element size
counter.
' We also must move the bytes over by a mult of 10 if there is no
comma found.

' bAlt=((bAltDM(1))*1000)+((bAltDM(2))*100)+((bAltDM(3))*10)+
((bAltDM(4)))
dim comma as byte
comma = (asc(","))
If (bAltDM(1)<> comma) Then
bAltltDM(1)
ElSize=1
If (bAltDM(2) <> comma) Then
bAlt=(bAlt*10)+bAltDM(2)
ElSize=ElSize+1
If (bAltDM(3) <> comma) Then
bAlt=(bAlt*10)+bAltDM(3)
ElSize=ElSize+1
If (bAltDM(4) <> comma) Then
bAlt=(bAlt*10)+bAltDM(4)
ElSize=ElSize+1
' bAlt2=((bAltDM(5))*100)+((bAltDM(6))*10)+((bAltDM(7)))
If (bAltDM(5)<> comma) Then
bAlt2ltDM(5)
ElSize2=ElSize2+1
If (bAltDM(6) <>
comma) Then
bAlt2(bAlt2*10)+bAltDM(6)

ElSize2=ElSize2+1
If (bAltDM(7)
<> comma) Then
bAlt2(bAlt2*10)+bAltDM(7)

ElSize2=ElSize2+1
End if
End If
End If
End if
End If
End If
Else
bAltte(asc("0"))
ElSize=2
End If
End SUb

'---------------------------------
------------------
Sub SaveData()
Dim AltSize as long
Dim AltSize2 as long

AltSize = clng(ElSize)
AltSize2 = clng(ElSize2)

If(Current_EEPROM_Address >= EEPROM_End_Address-34) Then
'out of storage space
Exit Sub
End If

Call PutPin(RedLEDpin, LEDon)
Call Delay(0.07)
call PutPin(RedLEDpin, LEDOff)
Call Delay(0.3)
'Speed of Sound
Call PutEEPROM(Current_EEPROM_Address,Range, 4)
Current_EEPROM_Address=Current_EEPROM_Address + 4
'Pressure Sensor
Call PutEEPROM(Current_EEPROM_Address, Volt, 4)
Current_EEPROM_Address=Current_EEPROM_Address + 4
'Time
Call PutEEPROM(Current_EEPROM_Address, bHour, 2)
Current_EEPROM_Address=Current_EEPROM_Address + 2
Call PutEEPROM(Current_EEPROM_Address, bMin, 2)
Current_EEPROM_Address=Current_EEPROM_Address + 2
Call PutEEPROM(Current_EEPROM_Address, sSec, 4)
Current_EEPROM_Address=Current_EEPROM_Address + 4
'Latitude
Call PutEEPROM(Current_EEPROM_Address, bLatDeg, 2)
Current_EEPROM_Address=Current_EEPROM_Address + 2
Call PutEEPROM(Current_EEPROM_Address, bLatMin, 2)
Current_EEPROM_Address=Current_EEPROM_Address + 2
Call PutEEPROM(Current_EEPROM_Address, bLatMinS, 2)
Current_EEPROM_Address=Current_EEPROM_Address + 2
Call PutEEPROM(Current_EEPROM_Address, bLatMinSS, 2)
Current_EEPROM_Address=Current_EEPROM_Address + 2
'Longitude
Call PutEEPROM(Current_EEPROM_Address, bLonDeg, 3)
Current_EEPROM_Address=Current_EEPROM_Address + 3
Call PutEEPROM(Current_EEPROM_Address, bLonMin, 2)
Current_EEPROM_Address=Current_EEPROM_Address + 2
Call PutEEPROM(Current_EEPROM_Address, bLonMinS, 2)
Current_EEPROM_Address=Current_EEPROM_Address + 2
Call PutEEPROM(Current_EEPROM_Address, bLonMinSS, 2)
Current_EEPROM_Address=Current_EEPROM_Address + 2
'velocity
Call PutEEPROM(Current_EEPROM_Address, bVelo, 3)
Current_EEPROM_Address=Current_EEPROM_Address + 3
Call PutEEPROM(Current_EEPROM_Address, bVelo2, 1)
Current_EEPROM_Address=Current_EEPROM_Address + 1
'altitude size
Call PutEEPROM(Current_EEPROM_Address, ElSize, 2)
Current_EEPROM_Address=Current_EEPROM_Address + 2
Call PutEEPROM(Current_EEPROM_Address, ElSize2, 2)
Current_EEPROM_Address=Current_EEPROM_Address + 2
'altitude value
Call PutEEPROM(Current_EEPROM_Address, bAlt, ElSize)
Current_EEPROM_Address=Current_EEPROM_Address + AltSize
Call PutEEPROM(Current_EEPROM_Address, bAlt2, ElSize2)
Current_EEPROM_Address=Current_EEPROM_Address + AltSize2

If(Current_EEPROM_Address >= EEPROM_End_Address) Then
'out of storage space
Exit Sub
End If

Call PutPin(RedLEDpin, LEDon)
Call Delay(0.07)
call PutPin(RedLEDpin, LEDOff)
Call Delay(0.3)

End Sub
'---------------------------------
------------
Sub UploadData(ByVal EEPROM_Start_Address As Long, ByVal
EEPROM_End_Address As Long)
Dim Address as Long
Dim AltSize as Long
Dim AltSize2 as Long

Address = EEPROM_Start_Address

Call PutPin(RedLEDpin, LEDon)
Call Delay(0.07)

Call PutPin(GreenLEDpin, LEDon)
Call Delay(0.07)

Do
Debug.Print "$$";

'Speed of Sound
Call GetEEPROM(Address, Range, 4)
Debug.Print CStr(Range); ", ";
Address = Address+4

'Pressure Sensor
Call GetEEPROM(Address, Volt, 4)
Debug.Print CStr(Volt);
Address = Address+4

'Time HH:MM:SS
Call GetEEPROM(Address, bHour, 2)
Debug.Print CStr(bHour); ":";
Address = Address+2
Call GetEEPROM(Address, bMin, 2)
Debug.Print CStr(bMin); ":";
Address = Address+2
Call GetEEPROM(Address, sSec, 4)
Debug.Print CStr(bSec); ",";
Address = Address+4

'Lat DD MM.SSSS
Call GetEEPROM(Address, bLatDeg, 2)
Debug.Print CStr(bLatDeg); chr(Deg);
Address = Address+2
Call GetEEPROM(Address, bLatMin, 2)
Debug.Print CStr(bLatMin); ".";
Address = Address+2
Call GetEEPROM(Address, bLatMinS, 2)
Debug.Print CStr(bLatMinS);
Address = Address+2
Call GetEEPROM(Address, bLatMinSS, 2)
Debug.Print CStr(bLatMinSS); ", ";
Address = Address+2

'Lon DDD MM.SSSS
Call GetEEPROM(Address, bLonDeg, 3)
Debug.Print CStr(bLonDeg); chr(Deg);
Address = Address+3
Call GetEEPROM(Address, bLonMin, 2)
Debug.Print CStr(bLonMin); ".";
Address = Address+2
Call GetEEPROM(Address, bLonMinS, 2)
Debug.Print CStr(bLonMinS);
Address = Address+2
Call GetEEPROM(Address, bLonMinSS, 2)
Debug.Print CStr(bLonMinSS); ", ";
Address = Address+2

'velocity VVV.V
Call GetEEPROM(Address, bVelo, 3)
Debug.Print CStr(bVelo); ".";
Addressdress + 3
Call GetEEPROM(Address, bVelo2, 1)
Debug.Print CStr(bVelo); ",";
Addressdress + 1

'Altitude AAA.A to AAAAA.A
'getting size of altitude storage
Call GetEEPROM(Address, ElSize, 2)
Address = Address+2
AltSize = clng(Elsize)
Call GetEEPROM(Address, ElSize2, 2)
Address = Address+2
AltSize2 = clng(ElSize2)
'getting Altitude
Call GetEEPROM(Address, bAlt, ElSize)
Debug.Print Cstr(bAlt); ".";
Address = Address+AltSize
Call GetEEPROM(Address, bAlt2, ElSize2)
Debug.Print Cstr(bAlt2); ", ";
Address = Address+AltSize2
'End of Data Sentence
Debug.Print "&&"
Loop Until (Address >= EEPROM_End_Address)
Debug.Print "EOF"

Call PutPin(RedLEDpin, LEDoff)
Call Delay(0.03)
Call PutPin(GreenLEDpin, LEDoff)
Call Delay(0.07)

exit sub

End Sub

'---------------------------------
----------
Private Sub ClearMemoryBlock( _
ByVal EEPROM_Start_Address As Long, _
ByVal EEPROM_End_Address As Long)

' This procedure clears the specified EEPROM memory block.
Dim Flash as Integer
Dim Address As Long
Dim ElementCount As Long
Dim N As Long
Dim Temp As Integer
Dim ElementSize as Integer
Call PutPin(RedLEDpin, LEDon)
Call Delay(0.07)
Call PutPin(GreenLEDpin, LEDon)
Call Delay(0.07)
Debug.Print "Clearing EEPROM"; " block. "
Debug.Print "This may take 3"; " or 4 minutes. "

Temp = 0
ElementSize = 2
ElementCount = ( (EEPROM_End_Address - EEPROM_Start_Address) \
CLng(ElementSize) ) + 1

Address = EEPROM_Start_Address
For N = 1 To ElementCount
Call PutEEPROM(Address, Temp, ElementSize)
Address = Address + CLng(ElementSize)
Next

Debug.Print "Done."
Call PutPin(RedLEDpin, LEDoff)
Call Delay(0.07)
Call PutPin(GreenLEDpin, LEDoff)
Call Delay(0.07)

'flash LED for coolness when complete
Do until (Flash)
' Red pulse.
Call PutPin(RedLEDpin, LEDon)
Call Delay(0.07)
Call PutPin(RedLEDpin, LEDoff)

Call Delay(0.07)

' Green pulse.
Call PutPin(GreenLEDpin, LEDon)
Call Delay(0.07)
Call PutPin(GreenLEDpin, LEDoff)

Call Delay(0.07)
Flash=Flash+1
Loop

End Sub

'---------------------------------
-----

> ... another way to do this...

Yeah, you got tied in knots.

A suggestion to anyone who wants to get GPS data from a GPS receiver: if
a machine-friendly protocol is available from the receiver, consider
using it instead of NMEA. NMEA is ASCII, and must be converted to
floating-point values to be usable by code. That's a good step to avoid
if you can. SiRF has its own protocol, Trimble has one, Garmin has a
simple text mode; each of these might be easier to use than NMEA.

I've rewritten a few areas of your code. No guarantee that it will
work, but it should help. I removed all of your Delays, so you might
want to throttle the reporting - not the collection and processing - of
data.

This code defines a function, sGetFieldValue(), that makes a single out
of a text string value, like altitude in GGA, byte-at-a-time. BasicX
also offers a procedure, ValueS, that converts text strings to values.

Hope this helps.
Tom
'-------

Sub Main()

Const SwitchClosed As Byte = 0

If (FirstTime) Then
' Uncomment these lines to clear the block of EEPROM memory.
' Call ClearMemoryBlock(EEPROM_Start_Address, EEPROM_End_Address)
' Exit Sub
' Debug.print "First time"
Current_EEPROM_Address = EEPROM_Start_Address
Else
Current_EEPROM_Address = Last_EEPROM_Address
debug.print "last address"
End If

' If (GetPin(UploadSwitchPin) = SwitchClosed) Then
' Call UploadData(EEPROM_Start_Address, EEPROM_End_Address)
' Else
call OpenNMEAin(lInSpeed) 'input

do
Last_EEPROM_Address = Current_EEPROM_Address
call PutPin(GreenLEDpin, LEDOn)
'Get Data from experiments
Call GetData
'Get GPS data
call GetNMEA
' call DisplayData
'Save Data
If(Current_EEPROM_Address >= EEPROM_End_Address) Then
'out of storage space
Exit Sub
Else
Call SaveData
End If
call PutPin(GreenLEDpin, LEDOff)
call PutPin(RedLEDpin, LEDon)
Call Delay(0.010) 'flash
Call PutPin(RedLEDpin, LEDoff)
loop

' End If

End Sub

Sub GetNMEA()

Dim bNMEAData As Byte, tfSuccess as boolean

call GetByte_3(bNMEAData,tfSuccess)
if (tfSuccess) Then
if bNMEAData=asc("$") then
bChecksum=0
call GetBytes(bNMEA_Cmd,5)
if (bNMEA_Cmd(1)=asc("G")) and (bNMEA_Cmd(2)=asc("P")) and
(bNMEA_Cmd(3)=asc("R")) and (bNMEA_Cmd(4)=asc("M")) and
(bNMEA_Cmd(5)=asc("C")) then
'case "GPRMC"

'$GPRMC,192631,A,3443.2547,N,08638.5393,W,015.1,180.3,140308,002.6,W,A*1D
call SkipCommas(1)
call GetDigits(bUTCTime,6) 'get
time item
call SkipCommas(1) 'discard 1 comma
call getValidity
call SkipCommas(1)
call GetDigits(bLatDM,9) 'get
ddmm.mmmm
call SkipCommas(2)
call GetDigits(bLonDM,10) 'get
dddmm.mmmm
call SkipCommas(2)
'comment this out for no signal
call GetDigits(bVelDM,5) 'get
vvv.v, 'comment this out for no signal
call SkipCommas(2)
'change this to 3 for no signal normally 1
call GetDigits(bUTCDate,6) 'get
date item

do
call GetBytes(bRawChecksum,1) 'discard but
checksum
loop until (bRawChecksum(1)=asc("*"))
bChecksumhecksum xor bRawChecksum(1) 'remove *
from checksum
call GetChecksumBytes(bRawChecksum,2)
call CalcNMEAChecksum
' if tfValid then 'data valid
'' Call PutPin(RedLEDpin, LEDon)
' call SetDateTime 'set local clock
' Call PutPin(RedLEDpin, LEDoff)
' end if

elseif (bNMEA_Cmd(1)=asc("G")) and (bNMEA_Cmd(2)=asc("P"))
and (bNMEA_Cmd(3)=asc("G")) and (bNMEA_Cmd(4)=asc("G")) and
(bNMEA_Cmd(5)=asc("A")) then
'case "GPGGA"

'$GPGGA,192631,3443.2547,N,08638.5393,W,1,05,2.9,192.4,M,-30.7,M,,*7A
call SkipCommas(9)
sAltitude = sGetFieldValue 'get Altitude aaaaa.a
possible 7 bytes
do
call GetBytes(bRawChecksum,1) 'discard but
checksum
loop until (bRawChecksum(1)=asc("*"))
bChecksumhecksum xor bRawChecksum(1) 'remove *
from checksum
call GetChecksumBytes(bRawChecksum,2)
call CalcNMEAChecksum
end if
end if
end If
Call SetDateTime
Call GPSData
End Sub

'-------------

Function sGetFieldValue () as Single
' Build a Single from "234.5678,"-like ASCII string
Dim bNMEAData As Byte, tfSuccess as boolean, bScale as byte
sGetFieldData = 0.0
bScale = 0
do
do
call GetByte_3(bNMEAData,tfSuccess)
loop until (tfSuccess)
bChecksum = bChecksum xor bNMEAData 'get and checksum bytes
select bNMEAData
case asc(",")
case asc("*")
case asc(".")
bScale = 1 'note decimal point
case else 'numerals
sAltitude = sAltitude * 10.0 + csng(bNMEAData-asc("0"))
if (bScale <> 0) then 'count decimal places
bScale = bScale + 1
end if
end select
loop until bNMEAData = asc(",") 'or bNMEAData = asc("*") only
reqd for last field
if (bScale <> 0) then
sGetFieldData = sGetFieldData / (10.0 ^ csng(bScale - 1))
'scale value
end if

End Function

I should have also mentioned that Micromega Corp's MFPU v3 (
http://micromegacorp.com/
http://groups.yahoo.com/group/uMFPU/?yguid=1284642 ) is able to
receive and decode NMEA sentences and convert fields to useful values
- autonomously without BasicX involvement, except to receive the values.

Of course, nav math can be done on that part, too.
Tom