Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

problem in nmea GPS string parsing

Status
Not open for further replies.

kulachi

Newbie level 5
Joined
Mar 25, 2009
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,370
problem in nmea parsing

hello all
i m doing a project of gps datalogger n i need to parse the gps sting
i m using Proton Development Suite compler to compile the code i m interesed in latitude and longitude of the string i m uploading my code but it not working it jst waits for the $GPRMC but dont get the string if any one can help me out with the error with this code or upload another code for the GPS NMEA parsing
i will b very thankful
Regards
Ali


*******************

Device 16F877A
XTAL 20
RSIN_PIN portC.7
RSIN_MODE true
SERIAL_BAUD 4800
INPUT PortC.7
Dim arr[50] As Byte
Dim long[50] As Byte

Dim i As Byte

Dim RsByte As Byte
Dim lat_d, long_d As Byte

Cls
Print "GPS Interfacing"
Delayms 1000
Main:
i = 0
RSIN WAIT( "$GPRMC" ) , RsByte
RSIN WAIT( "," ) , RsByte
RSIN WAIT( "," ) , RsByte
arr[0] = RsByte
RsByte = Rsin
arr[1] = RsByte
RsByte = Rsin
arr[2] = RsByte
RsByte = Rsin
arr[3] = RsByte
RsByte = Rsin
arr[4] = RsByte
RsByte = Rsin
arr[5] = RsByte
RsByte = Rsin
arr[6] = RsByte
RsByte = Rsin
arr[7] = RsByte
RsByte = Rsin
arr[8] = RsByte
RsByte = Rsin
arr[9] = 0

;RsByte = Rsin
;RsByte = Rsin
lat_d = Rsin
RSIN WAIT( "," ) ,str long \10
long[11]=0
Print At 3,-3, str long " "
RSIN WAIT( "," ) ,str long \10
long[11]=0
Print At 4,-3, str long " "
Print At 2,1,lat_d," "
Goto Main
 

Re: problem in nmea parsing

kulachi said:
hello all
i m doing a project of gps datalogger n i need to parse the gps sting
i m using Proton Development Suite compler to compile the code i m interesed in latitude and longitude of the string i m uploading my code but it not working it jst waits for the $GPRMC but dont get the string if any one can help me out with the error with this code or upload another code for the GPS NMEA parsing
i will b very thankful
Regards
Ali


*******************

Device 16F877A
XTAL 20
RSIN_PIN portC.7
RSIN_MODE true
SERIAL_BAUD 4800
INPUT PortC.7
Dim arr[50] As Byte
Dim long[50] As Byte

Dim i As Byte

Dim RsByte As Byte
Dim lat_d, long_d As Byte

Cls
Print "GPS Interfacing"
Delayms 1000
Main:
i = 0
RSIN WAIT( "$GPRMC" ) , RsByte
RSIN WAIT( "," ) , RsByte
RSIN WAIT( "," ) , RsByte
arr[0] = RsByte
RsByte = Rsin
arr[1] = RsByte
RsByte = Rsin
arr[2] = RsByte
RsByte = Rsin
arr[3] = RsByte
RsByte = Rsin
arr[4] = RsByte
RsByte = Rsin
arr[5] = RsByte
RsByte = Rsin
arr[6] = RsByte
RsByte = Rsin
arr[7] = RsByte
RsByte = Rsin
arr[8] = RsByte
RsByte = Rsin
arr[9] = 0

;RsByte = Rsin
;RsByte = Rsin
lat_d = Rsin
RSIN WAIT( "," ) ,str long \10
long[11]=0
Print At 3,-3, str long " "
RSIN WAIT( "," ) ,str long \10
long[11]=0
Print At 4,-3, str long " "
Print At 2,1,lat_d," "
Goto Main

Ok, I do not know which GPS receiver/module you are using, but I've made some things with Telit GM862 GPS module and I'm not parsing NMEA sentences instead I'm using another method, but here is a piece of code that you can analyse and figure out the way that I used to extract data:

Code:
ReadPosition:
	HRSOut "AT$GPSACP", CR
	HRSIn Wait ("$GPSACP: "), UTCh[0], UTCh[1], UTCm[0], UTCm[1], UTCs[0], UTCs[1]
	HRSIn Wait (","), Str Latitude\10
	
	If Latitude[0] = "," Then
		Print At 2, 1, "No GPS Lock"
		NoLock = 1
		High NoFixLED
		GoTo ExitIP
	EndIf
	
	NoLock = 0
	
	Low NoFixLED
	
	HRSIn Wait (","), Str Longitude\11
	HRSIn Wait (","), dummy
	HRSIn Wait (","), dummy
	HRSIn Wait (","), dummy
	HRSIn Wait (","), dummy
	HRSIn Wait (","), dummy
	HRSIn Wait (","), dummy
	HRSIn Wait (","), Str Date\6
	HRSIn Wait (","), Str NoOfSat\2
	GoSub Delay50
    ' setting up the module clock (RTC)
	If Clock = 0 Then
		GoSub SetupClock
	EndIf
	
ExitIP:
Return

HTH
 

    kulachi

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top