Problem in connection with GPS OEM (using BS2)
we have been trying to develop an AVLS system using a BS2 mcu and an Axiom Sandpiper II, OEM GPS module.
we have tried the GPS module with its default software[noparse][[/noparse]conductor] and we always get the correct position displayed on the screen.
we have been trying to use the BS2 SERIN command to extraxt NMEA data from the GPS module. we are aware of the fact that BS2 has only 24 bytes of RAM where as the GPRMC string has 65 chracters in it. we also tried the GPGLL string.[noparse][[/noparse]please see the full code below to understand the variable names]
SERIN 8, 16572,[noparse][[/noparse]WAIT ("$GPGLL"),SKIP 1,DEC lat1,SKIP 1,DEC lat2,comma,latd,comma,DEC lon1,comma,DEC lon2,comma,lond]
with our code we were able to extract the correct position only 30% times on average. we have been trying different codes with SERIN to get a steady stream of correct position data. the same GPS module workds fine with the default software. so we guess there is nothing wrong with the GPS OEM. we have tried to change the baud rate and get the NMEA string. but every effort has failed. I am sure that there is something wrong in the way we are trying to read and parse the GPGLL and GPRMC strings.I am providing the full code.
====================================================
' {$STAMP BS2}
' {$PBASIC 2.5}
lat1 VAR Word
lat2 VAR Word
latd VAR Byte
lon1 VAR Word
lon2 VAR Word
lond VAR Byte
comma VAR Byte
SERIN 8, 16572,[noparse][[/noparse]WAIT ("$GPGLL"),SKIP 1,DEC lat1,SKIP 1,DEC lat2,comma,latd,comma,DEC lon1,comma,DEC lon2,comma,lond]
DEBUG "testX"
DEBUG DEC ? lat1
DEBUG "*"
DEBUG DEC ? lat2
DEBUG "*"
DEBUG· ? latd
DEBUG "*"
DEBUG DEC ? lon1
DEBUG "*"
DEBUG DEC· ? lon2
DEBUG "*"
DEBUG· ? lond
DEBUG "ok"
END
*****************
please provide me some suggestions as to what is going wrong.
appreciate your help
we have tried the GPS module with its default software[noparse][[/noparse]conductor] and we always get the correct position displayed on the screen.
we have been trying to use the BS2 SERIN command to extraxt NMEA data from the GPS module. we are aware of the fact that BS2 has only 24 bytes of RAM where as the GPRMC string has 65 chracters in it. we also tried the GPGLL string.[noparse][[/noparse]please see the full code below to understand the variable names]
SERIN 8, 16572,[noparse][[/noparse]WAIT ("$GPGLL"),SKIP 1,DEC lat1,SKIP 1,DEC lat2,comma,latd,comma,DEC lon1,comma,DEC lon2,comma,lond]
with our code we were able to extract the correct position only 30% times on average. we have been trying different codes with SERIN to get a steady stream of correct position data. the same GPS module workds fine with the default software. so we guess there is nothing wrong with the GPS OEM. we have tried to change the baud rate and get the NMEA string. but every effort has failed. I am sure that there is something wrong in the way we are trying to read and parse the GPGLL and GPRMC strings.I am providing the full code.
====================================================
' {$STAMP BS2}
' {$PBASIC 2.5}
lat1 VAR Word
lat2 VAR Word
latd VAR Byte
lon1 VAR Word
lon2 VAR Word
lond VAR Byte
comma VAR Byte
SERIN 8, 16572,[noparse][[/noparse]WAIT ("$GPGLL"),SKIP 1,DEC lat1,SKIP 1,DEC lat2,comma,latd,comma,DEC lon1,comma,DEC lon2,comma,lond]
DEBUG "testX"
DEBUG DEC ? lat1
DEBUG "*"
DEBUG DEC ? lat2
DEBUG "*"
DEBUG· ? latd
DEBUG "*"
DEBUG DEC ? lon1
DEBUG "*"
DEBUG DEC· ? lon2
DEBUG "*"
DEBUG· ? lond
DEBUG "ok"
END
*****************
please provide me some suggestions as to what is going wrong.
appreciate your help
Comments
Alohas
Post Edited (Robert@HCC) : 7/22/2006 10:10:49 AM GMT
See if the following alterations help. The unwanted commas may well·sort themselves out, I believe:
SERIN 8, 16572,[noparse][[/noparse]WAIT ("$GPGLL"),SKIP 1,DEC lat1,SKIP 1,DEC lat2,latd,DEC lon1,DEC lon2,lond]
If for some reason that doesn't get you going, then try this:
SERIN 8, 16572,[noparse][[/noparse]WAIT ("$GPGLL"),SKIP 1,DEC lat1,SKIP 1,DEC lat2,SKIP 1,latd,SKIP 1,DEC lon1,SKIP 1,DEC lon2,SKIP 1,lond]
What I have tried to do in each case is to reduce or minimize·the amount of PBASIC processing overhead. In the first case, we're trading the speed of checking for unwanted characters in a DEC field (which PBASIC will ignore innately) for actually fetching and moving data into storage (a longer process); which characters we really don't want to begin with. In the second case we're avoiding the unwanted character check, and the fetch/move by using another·set of SKIPs·which basically advance a buffer pointer, which takes little time at all.
Regards,
Bruce Bates
[noparse][[/noparse] I'm a "magic number" guy, not with the Elements of PBASIC Style sort. ]
perhaps also try a slimmed down version as below.
I use this with a Jupiter OEM module.
Basically it doesn't mind if its $GPRMC or $GPGLL or any of the other NMEA Data messages as its only looking for the
correct degrees/mins in a string then only graps the 4 seconds.
****Obviously change the degs/mins to suit your exact location****
' {$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
I am also engaged in a similar project.
If I specify the lat/long for a specific location can I use my device for roaming around?
as my GPS device shall be moving around my country ,I can not specify it to a specific lat or long.
can you please suggest me a way, by which I can make a general program that will work in any location.
I will ofcourse try the other solutions provided in this thread.
thank you all.
shakil
previously was/is designed for use with a 4x20 LCD, but it
will work anywhere.· The only thing that it WAITs for is
'GLL' and·then it's off to the races.
I'm new to GPS as well. The minimum simple code I posted above was purely for testing of the thread originators (Akmarif) GPS
as it was reported as being correct only 30% of the time. I'll be using the code (with refinements) below as the starting point for
my project, which looks like its what you are trying to achieve.
Good luck, let me know how you get on as its interesting to see how problems are resolved in a different manner.
Stuart
' {$STAMP BS2}
' {$PORT COM1}
deg1 VAR Byte : deg2 VAR Byte : minu1 VAR Byte : minu2 VAR Byte
per1 VAR Byte : sec1 VAR Byte : sec2 VAR Byte : sec3 VAR Byte
sec4 VAR Byte : deg3 VAR Byte : deg4 VAR Byte : deg5 VAR Byte
minu3 VAR Byte : minu4 VAR Byte : per2 VAR Byte : sec5 VAR Byte
sec6 VAR Byte : sec7 VAR Byte : sec8 VAR Byte
' RMC
Main:
DEBUG HOME
SERIN 0,188,[noparse][[/noparse]WAIT("RMC,"),SKIP 9, deg1,deg2,minu1,minu2,per1,sec1,sec2,sec3,sec4,SKIP 3,deg3,deg4,deg5,minu3,minu4,per2,sec5,sec6,sec7,sec8]
PAUSE 100
DEBUG " Lattitude"," ","Longitude",CR
DEBUG "GPRMC ", deg1,deg2, minu1,minu2,per1,sec1,sec2,sec3,sec4," ",deg3,deg4,deg5,minu3,minu4,per2,sec5,sec6,sec7,sec8,CR
PAUSE 100
GOTO Main