Serin and debug out of GPS data
Stuarttttt
Posts: 45
Hi,
whats the easiest method of recieving a data string with Dec nos, periods, alphanumericals etc (possibly of unknown lengths) and displaying it on the debug screen. (and also having the information such as latittude 5201.1234 available for use) Using a BS2.
ie. gettting and displaying GPS info from various length NMEA messages such as
$GPRMC,185203,A,5201.1234,N,0001.1234,W,0.000,121.7,160496,13.8,E*55
The way I'm using so far seems long winded and cumbersome. ie.
Main:
SERIN 0,188,[noparse][[/noparse]WAIT("RMC"), hr, mn,· sec,· four,· five, six,· seven,· eight,· nine,· ten, eleven,· twelve, thirt, fourt, fift, sixt]· etc
PAUSE 100
DEBUG "GPRMC ", hr," ", mn,"· ",· sec,"· ", four,"· ",· five,"· ",· six,"· ",· seven,"· ",· eight,"· ",· nine,"· ", ten,"· ",· eleven,"· ",· twelve,"· ",thirt,"· ",fourt,"· ", fift,"· ", sixt, CR
PAUSE 100
GOTO Main
Thanks
···· Regards
····· ·Stuart
·
whats the easiest method of recieving a data string with Dec nos, periods, alphanumericals etc (possibly of unknown lengths) and displaying it on the debug screen. (and also having the information such as latittude 5201.1234 available for use) Using a BS2.
ie. gettting and displaying GPS info from various length NMEA messages such as
$GPRMC,185203,A,5201.1234,N,0001.1234,W,0.000,121.7,160496,13.8,E*55
The way I'm using so far seems long winded and cumbersome. ie.
Main:
SERIN 0,188,[noparse][[/noparse]WAIT("RMC"), hr, mn,· sec,· four,· five, six,· seven,· eight,· nine,· ten, eleven,· twelve, thirt, fourt, fift, sixt]· etc
PAUSE 100
DEBUG "GPRMC ", hr," ", mn,"· ",· sec,"· ", four,"· ",· five,"· ",· six,"· ",· seven,"· ",· eight,"· ",· nine,"· ", ten,"· ",· eleven,"· ",· twelve,"· ",thirt,"· ",fourt,"· ", fift,"· ", sixt, CR
PAUSE 100
GOTO Main
Thanks
···· Regards
····· ·Stuart
·
Comments
' {$STAMP BS2}
Latt VAR Byte(5)
Long VAR Byte(5)
Latt(4)=0
Long(4)=0
Main:
DEBUG HOME
DEBUG "Lattitude(secs)","···· ",····· "Longitude(secs)",CR
SERIN 0,188,[noparse][[/noparse]WAIT ("5241."),STR Latt\4]
SERIN 0,188,[noparse][[/noparse]WAIT ("00112."),STR Long\4]
DEBUG "·· ",STR Latt,"··············· ", STR Long,CR
PAUSE 800
GOTO Main
But how can STR arrays handle and display a·long (NMEA) string ?· ie, 69 items.·· ·Any takers ?
Stuart
Then, watch for the leading characters again, except now SKIP the first 15 chars and grab 15 more characters, process, grab some more, etc.
What most people realize quite quickly is that they don't always need as much data as they think and you can make some decisions as to what data to concentrate on.
Cheers
Ah yes, good idea, I'll give that a try. Also good point about only taking the data needed rather than everything available.
Regards
Stuart
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen