Connecting a GPS unit to the Rover


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.


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 -

'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


'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


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

The output from the GPS as seen directly

---------------10 ------20 -------30 -------40 -------(42 characters are saved)


Part of NMEA Reference Manual