Connecting a GPS unit to the Rover

Objective

Transmit GPS navigation data from the Rover to the Sweex Router and have it display on the webpage that is being used by the remote vehicle driver.

Method

Fix a second hand GPS unit to the Rover. This sends out standard NMEA strings every second via rs232.
Receive the string using the Oshonsoft Basic software UART on port D3.
Have the stream pass up through a 3 byte array start_code(2) - all bytes move up by one position as the next byte comes in at the bottom.
When the code GGA is stored in the array save the next 42 bytes in array a(42)
.
Send this string to the Sweex for parsing to extract latitude and longitude.

First working test using a PC to read the PIC output in Hyperterminal -


'GPS2port.bas
'GPS module connected to MAX232 on PORTD.3
'software UART receives data stream at 4800 baud and when code GGA is detected we capture 42 bytes
'in array a(42) then send these to the PC via hardware UART at 9600 baud

Dim start_code(2) As Byte 'enables scan of the last 3 characters received
Dim a(42) As Byte 'save the data stream we need in here
Dim x As Word
Dim i As Byte
Dim j As Byte

Hseropen 9600 'for sending captured string to PC
WaitMs 1000

Hserout "Ready - waiting for an GGA (decimal 71 71 65) - then save 42 bytes ", CrLf, CrLf

loop:

'move the received bytes up the start_code array
For i = 2 To 1 Step -1
j = i - 1
start_code(i) = start_code(j)
Next i

Serin PORTD.3, 4800, start_code(0)

'if GGA received start to save the data stream in a(42)
If start_code(2) = 71 And start_code(1) = 71 And start_code(0) = 65 Then Goto read_now Else Goto loop

read_now:

For x = 1 To 42
Serin PORTD.3, 4800, a(x)
Next x

Hserout CrLf, "42 characters saved after start code GGA follow", CrLf
WaitMs 500
For x = 1 To 42
Hserout a(x) 'spit the array elements down the rs232 hardware UART
Next x
Hserout CrLf, CrLf
WaitMs 500
Goto loop


Hyperterminal display (unit not outdoors - no real signals)-

42 characters saved after start code GGA follow
,005955.780,0000.0000,N,00000.0000,E,0,00*

The output from the GPS as seen directly

$GPGGA,235948.000,0000.0000,N,00000.0000,E,0,00,50.0,0.0,M,0.0,M,0.0,0000*77
------123456789012345678901234567890123456789012
---------------10 ------20 -------30 -------40 -------(42 characters are saved)

-------time-------Lat---------Long-----------sats
$GPRMC,235948.000,V,36000.0000,N,72000.0000,E,0.000000,,120403,,*3F
$GPVTG,,T,,M,0.000000,N,0.000000,K*4E

Part of NMEA Reference Manual