Here is some code that allows a pic to recieve data from a GPS module.
It will wait for 3000 msec's and then if it does not recieve anything it will jump down to the "tmout" subroutine.
It parses the received serial data and places various parts of it into separate variables.
then it tests one of the values "fix" and jumps to a different subroutine based on its value.
Code:
SerIn2 PORTA.0,188,3000,tmout,[wait("$GPRMC,"),DEC2 hh,DEC2 mm,dec2 ss,_
wait(","),fix,wait(","),DEC2 latdeg,DEC2 latmin,wait("."),dec4 latminn,_
wait(","),NS,wait(","),DEC3 londeg,DEC2 lonmin,wait("."),dec4 lonminn,_
wait(","),EW,wait(","),dec knots,dec knotsten,dec course,_
wait(","),DEC2 dy,DEC2 mt,DEC2 yr]
Code:
if fix="V" then goto nofix
Code:
nofix:
lcdout $fe,1,"waiting for fix"
pause 1000
goto main
tmout:
LCDOUT $fe,1,"timeout"
PAUSE 1000
GOTO MAIN
might be something here you can use.
note: I do not believe you need to (nor can you) use the == way of assigning or testing equality. You may need to refer to the PBP manual.
good luck
Bookmarks