08M2 GPS Simulator

Mike_cj0

Member
For a project im working on i will be processing gps and working out distances etc.

I figure the best way to do this will be to program an 08M2 to output via serial a set of gps nmea strings in a constant loop. Obviously when it restarts the loop the gps data will jump back in time but that shouldn't be a problem for basic testing of grabbing a GPRMC string and extracting data from it.

Code:
hsersetup B4800_4, %00
main:
hserout 0, ("$GPGSV")
hserout 0, ("$GPGSV")
hserout 0, ("$GPGGA")
hserout 0, ("$GPGSA")
hserout 0, ("$GPVTG")
hserout 0, ("$GPGLL")
hserout 0, ("$GPRMC,081055.04,A,5053.1981,N,00117.3796,W,60.27,129.07,040507,,,A*77")
hserout 0, ("$GPGSV")
hserout 0, ("$GPGSV")
hserout 0, ("$GPGGA")
hserout 0, ("$GPGSA")
hserout 0, ("$GPVTG")
hserout 0, ("$GPGLL")
hserout 0, ("$GPRMC,081055.94,A,5053.1848,N,00117.3683,W,59.57,131.98,040507,,,A*7D")
hserout 0, ("$GPGGA")
hserout 0, ("$GPVTG")
hserout 0, ("$GPGLL")
hserout 0, ("$GPRMC,081056.94,A,5053.1740,N,00117.3480,W,59.52,133.93,040507,,,A*74")
hserout 0, ("$GPGSV")
hserout 0, ("$GPGSV")
hserout 0, ("$GPGGA")
hserout 0, ("$GPVTG")
hserout 0, ("$GPGLL")
hserout 0, ("$GPRMC,081057.94,A,5053.1649,N,00117.3291,W,57.68,134.09,040507,,,A*78")
hserout 0, ("$GPGGA")
hserout 0, ("$GPGSA")
hserout 0, ("$GPVTG")
hserout 0, ("$GPGLL")
hserout 0, ("$GPRMC,081058.94,A,5053.1505,N,00117.3134,W,58.26,134.90,040507,,,A*75")
hserout 0, ("$GPGSV")
hserout 0, ("$GPGSV")
hserout 0, ("$GPGGA")
hserout 0, ("$GPVTG")
hserout 0, ("$GPGLL")
hserout 0, ("$GPRMC,081059.94,A,5053.1386,N,00117.2972,W,57.86,135.99,040507,,,A*7F")
hserout 0, ("$GPGGA")
hserout 0, ("$GPVTG")
hserout 0, ("$GPGLL")
hserout 0, ("$GPRMC,081100.94,A,5053.1258,N,00117.2817,W,57.79,137.50,040507,,,A*75")
hserout 0, ("$GPGSV")
hserout 0, ("$GPGSV")
hserout 0, ("$GPGGA")
hserout 0, ("$GPGSA")
hserout 0, ("$GPVTG")
hserout 0, ("$GPGLL")
hserout 0, ("$GPRMC,081102.04,A,5053.1115,N,00117.2655,W,57.82,139.24,040507,,,A*75")
hserout 0, ("$GPGGA")
hserout 0, ("$GPVTG")
hserout 0, ("$GPGLL")
hserout 0, ("$GPRMC,081102.94,A,5053.0996,N,00117.2528,W,57.91,141.13,040507,,,A*7E")
hserout 0, ("$GPGSV")
hserout 0, ("$GPGSV")
hserout 0, ("$GPGGA")
hserout 0, ("$GPVTG")
hserout 0, ("$GPGLL")
hserout 0, ("$GPRMC,081103.94,A,5053.0862,N,00117.2394,W,57.77,143.03,040507,,,A*7F")
hserout 0, ("$GPGGA")
hserout 0, ("$GPGSA")
hserout 0, ("$GPVTG")
hserout 0, ("$GPGLL")
hserout 0, ("$GPRMC,081105.04,A,5053.0715,N,00117.2249,W,57.57,144.66,040507,,,A*78")
hserout 0, ("$GPGSV")
hserout 0, ("$GPGSV")
hserout 0, ("$GPGGA")
hserout 0, ("$GPVTG")
hserout 0, ("$GPGLL")
hserout 0, ("$GPRMC,081106.04,A,5053.0580,N,00117.2116,W,57.45,145.98,040507,,,A*7F")
goto main
 

MartinM57

Moderator
That looks a severe test of anything you send it to - you might want to slow it down a bit (PAUSE statements) as a real GPS won't send data out as fast as your 08M2 will do with that code. Some GPSs only send out the same sentence once (or twice or five times or perhaps more) per second
 
Last edited:

srnet

Senior Member
Agree with Martin, repicate the behaviour of a normal GPS, which sends out a location fix typically once every 1 or 2 seconds.

Myself I would not use the RMC sentance for distance and direction calculation, the GGA sentance gives the number of satellites and quality of fix info allowing you to choose whether to accept the fix or not. I cant recall a situation where I had a RMC fix, without a GGA fix following a couple of seconds later.
 

darb1972

Senior Member
Hi

I'm no code expert but there seems to be a fair degree of repetitiveness in some of the serial out batches, except for the last line. I would suggest a few routines to save on code lines and typing. Others might correct me as I only really a novice at programing. It's just a suggestion.
 

nick12ab

Senior Member
@darb1972 - if you were tight on programming space and needed to fit lots more on, you could program it with loops and variables to reduce programming space.
 

MFB

Senior Member
The Near Space column in the 2009 July issue of Nuts & Volts magazine has a useful article about an 08M based GPS simulator, which generates GGA sentences that mimic the output from a balloon flight. It was possible to download it for free from the N&V but not sure if that it still the case.
 

darb1972

Senior Member
Thanks Nick. For me it's a matter of looking at lots of code on the forum and processing how I would go about structuring the programme. It's interesting how code can be written in many different ways but ultimately end in the same result. Thanks for the feedback.
 

Mike_cj0

Member
Thanks for the replies.

I have taken on board some of the comment and made some changes to the code so hopefully it will be a bit better.

Please note that the time, date, speed, course and checksum are all the same and are not valid.

For what i am working on i only need long and lat to start with.

Here is the updated code

Code:
symbol counter = w0

hsersetup B4800_4, %00

main:

	for counter =  0 to 9999
	
	
		hserout 0, ("$GPRMC,081055.04,A,5053.",counter,",N,00117.",counter,",W,60.27,129.07,040507,,,A*77")
	
		pause 1200
	
	next counter
	
	for counter =  9999 to 0 step -1
	
	
		hserout 0, ("$GPRMC,081055.04,A,5053.",counter,",N,00117.",counter,",W,60.27,129.07,040507,,,A*77")
	
		pause 1200
	
	next counter
	
	goto main
 

yv1hx

Member
I´m having a look to old posts and this popped to my eyes:

I'm a very old GPS user (since this equipments was shoe box sized), so i´m very confident with these equipments....

You need terminate every $GPxxxxxx,xxx,xx,etc,*checksum sentence with a CR+LF, so your example code would look like this:

Code:
hserout 0, ("$GPRMC,081055.04,A,5053.",counter,",N,00117.",counter,",W,60.27,129.07,040507,,,A*77",CR,LF)
Every $GPxxx sentence MUST be terminated in the CR + LF pair.

Good luck...
:D
 
Top