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
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