Reply by Tom Becker March 14, 20082008-03-14
This is not the way I would handle the field today (if you don't use
the crosstrack error, it wastes six bytes of RAM) but, since the
crosstrack error fields are fixed-length, you might try:

dim Navigate(1 to 7) as byte

Debug.Print " Navigate letter: "; cstr(Navigate(7))

call getValidity
call SkipCommas(1)
call GetBytes(Navigate,7) 'get Crosstrack error and Steer direction
Tom

Reply by Tom Becker March 13, 20082008-03-13
> ...Yes, will put "L,," in Navigate...

That's probably not what you want, since the "L" and the following two
fields aren't related. Why Dim Navigate (1 to 3)?

According to Dale, RMB looks like:
$GPRMB,A,0.66,L,003,004,4917.24,N,12309.57,W,001.3,052.5,000.5,V*20
where

RMB Recommended minimum navigation information

A Data status A = OK, V = Void (warning)
0.66,L Cross-track error (nautical miles), steer L or R
003 Origin waypoint ID
004 Destination waypoint ID
.... etc.

but your sample is:
$GPRMB,A,0.00,L,,SIGULD,5708.612,N,02450.922,E,25.760,61.5,,V,A*74
so you don't have an Origin waypoint ID from your device.

If all you want from that part of the sentence is the steer direction, I
would get the data this way:
call getValidity
call SkipCommas(2) 'ignore Crosstrack error
call GetBytes(Navigate,1) 'Steer
call SkipCommas(2) 'ignore Origin Waypoint ID
Tom

Reply by "guntis.laurins" March 13, 20082008-03-13
--- In b..., Tom Becker wrote:
>
> > call getValidity
> > call SkipCommas(2)
> > call GetBytes(Navigate,3)
>
> With the sample line you show:
> $GPRMB,A,0.00,L,,SIGULD,5708.612,N,02450.922,E,25.760,61.5,,V,A*74
>
> that code will put "L,," in Navigate, right?
> Tom
>
Yes , will put "L,," in Navigate !!! :)

I read about it in this website:

http://www.gpsinformation.org/dale/nmea.htm#RMB
Reply by "guntis.laurins" March 13, 20082008-03-13
Hello

With DateTimeNMEA example $GPRMC data I can see very well, now I want
to change this code so I can see in $GPRMB protocol Letters R and L,
they ar here, after 3th comma:
$GPRMB,A,0.00,L,,SIGULD,5708.612,N,02450.922,E,25.760,61.5,,V,A*74

On DateTimeNMEA example in Serial_24.bas and Suppert_24.bas I leave as
they where, but in DateTimeNMEA.bas I change to this:

' Accept 4800N81 NMEA from Pin 20
' Continuously Set BX-24 RTC to indicated UTC
' (~250mS delayed) from valid $GPRMC sentence
' Continuously Display RTC

' Tom Becker G...@RighTime.com 2002-08-10
'-------

' uses Serialport_24.bas and Support_24.bas

const bNMEAInPin as byte = 13
const lInSpeed as long = 4800
const bNMEAOutPin as byte = 0
Const Deg As Byte = 176 ' Graadu simbols.
dim tfValid as boolean
dim bLonDM(1 to 12) as byte 'dddmm.mmmm,W
' dim bLatDM(1 to 12) as byte 'dddmm.mmmm,W

dim bUTCDate(1 to 6) as byte
dim bUTCTime(1 to 6) as byte
dim bNMEA_Cmd(1 to 5) as byte
dim Navigate(1 to 3) as byte
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
dim bOldSec as byte

dim platumsDD as byte, platumsMM as byte
dim garumsDD as byte, garumsMM as byte

option explicit

'-------

Sub Main()

call OpenNMEAin(lInSpeed) 'input
' main loop
do
call GetNMEA
call Idle
loop

End Sub

'-------

Sub Idle()

Debug.Print " Navigate letter: "; cstr(cbyte(Navigate(1)))
End Sub

'-------

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

'NMEA2.3 from eTrex:
$GPRMB,A,0.00,L,,SIGULD,5708.612,N,02450.922,E,25.760,61.5,,V,A*74
'
$GPRMC,122952,A,5656.4802,N,02409.3489,E,0.0,324.0,190208,5.8,E,A*19

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("B")) then
'case "GPRMB"
call SkipCommas(1)
call getValidity

call SkipCommas(2)
call GetBytes(Navigate,3)

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 PutPin(RedLEDpin, LEDoff)
end if
end if

end if
end If

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
tfValidse
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 Idle
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 Idle
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 Idle
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 Idle
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 Idle
end if
loop until (tfSuccess)
bChecksumhecksum xor bNMEAData
if bNMEAData=asc("A") then
tfValid=true
else
tfValidse
end if

End Sub

'-------

Why my debug.print only shows zero or 8 when I was expecting 76 for L
and 82 for R ????

Maybe something is wrong with one of tfValid parts ???