RS232 GPS data

Mr S

New Member
Hi,

I am trying to read in GPS (GPRMC) data from a WD-G-ZX4120 GPS module. The device outputs RS232 at 9600baud and I am trying to read this on an 18X overclocked at 8MHz and reading in at 4800baud which i think should work out OK.

The code all seems to be working fine up to the point where it is looking for the "$GPRMC" header and then does not seem to proceed.

As you may gather i am on a bit of a learning curve having not done this before so please excuse my simple questions.

Firstly do I need to interface with an RS232 converter (MAX232?) to allow the picaxe to read RS232 levels? From what i've read i didn't thing this was needed but i'm not sure.

Also if i dont need to convert levels to be read can anyone see any obvious issues with my code that would prevent it working?

Cheers in advance,
Darryl

Code:

'Program to read in GPS serial data using overclocking to correct baud rate

'Assign input pin for GPS data and unit reset
symbol GPS_IN = 0
symbol GPS_reset = 5


'Assign Variables

symbol Lat1 = w0 'b0,b1
symbol Lat2 = w1 'b2,b3
symbol ns = b4 'w2
symbol ew = b5 'w2
symbol Lon1 = w3 'b6,b7
symbol Lon2 = w4 'b8,b9

' reset GPS receiver (needed on every startup)

High GPS_reset
Low GPS_reset
Pause 100
High GPS_reset


'Aquire data from serial stream


For b10 = 1 to 40


getgrmc:

setfreq m8 'Increase clock frequency to 8MHz to get 9600baud serial from GPS

Sertxd ("readinggps") 'diagnostic


serin GPS_IN, N4800, ("$GPRMC"),w0,w0,w0,Lat1,Lat1,Lat2,ns,Lon1,Lon2,ew 'read data by $GPRMC data format

Sertxd ("havereadgps") ' diagnostic

setfreq m4 'Return clock freq to normal 4MHz


'write contents of variables to Terminal emulator

Sertxd (#w0,44,#w1,44,w2,44,#w3,44,#b8,44,#b9,44,#w5,44,#w6,10) '44 is ascii "comma", 10 is ascii "return"

Pause 5000

Next b10

End
 

jmumby

Senior Member
NMEA standard has a baud rate of 4800 so your 9600 seems odd unless you have set this up somewhere else. Also you should be T4800 rather than N4800 if you have connected directly to the picaxe. You should just be able to connect directly to the picaxe but I have not seen the data sheet. So as a test I would set my freq to M8 and and T2400 and connect directly to the picaxe. Another thing - I would be surprised if the GPS is sending out RMC by default. You will probably need to turn it on with a NMEA command. Have a look at my thread in projects http://www.picaxeforum.co.uk/showpost.php?p=61935&postcount=4 I have been where you are about 2 months ago so it is still quite fresh in my head.
 
Last edited:

jmumby

Senior Member
I guess it depends on your GPS I certainly didn't need one. If you do chose to use one you will have to use N rather than T.
 

MartinM57

Moderator
So what would you recommend as a good GPS to start out playing with - assume reasonable competence in interfacing with it - in terms of size/price/performance/avaiability in the UK etc?
 

Mr S

New Member
Thanks for the help guys, i'm trying to determine whether the unit is aquiring satellites at the moment (turns out the datasheet for the GPS unit is very poor) other people who have used this unit with basic stamps have found that the status indicators dont do what the data sheet says it should!

I'm considering junking it and going for the unit that you described from Sparkfun as that seems to have everything on one board.

Once again thanks, this forum is unbelievably useful for numpties like me who are learning about microcontrollers!

Cheers,
Darryl
 
Top