Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 01:41 24 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : GPS

     Page 1 of 2    
Author Message
devigan
Newbie

Joined: 11/08/2011
Location: Australia
Posts: 26
Posted: 09:30am 22 Aug 2011
Copy link to clipboard 
Print this post

Hi Guys, can anyone guide me with GPS interface and read and log to SD. Daven
 
Keith @

Senior Member

Joined: 19/06/2011
Location: Australia
Posts: 167
Posted: 03:11am 23 Aug 2011
Copy link to clipboard 
Print this post

Daven

try this Microchip article as a starter

ww1.microchip.com/downloads/en/AppNotes/01373A.pdf

Keith
The more we know, the more we know we don't know !
 
Keith @

Senior Member

Joined: 19/06/2011
Location: Australia
Posts: 167
Posted: 03:14am 23 Aug 2011
Copy link to clipboard 
Print this post

Daven

delete the back shed prefix from the URL when you get the 404 error

Keith
The more we know, the more we know we don't know !
 
devigan
Newbie

Joined: 11/08/2011
Location: Australia
Posts: 26
Posted: 01:35am 25 Aug 2011
Copy link to clipboard 
Print this post

thanks
 
devigan
Newbie

Joined: 11/08/2011
Location: Australia
Posts: 26
Posted: 12:05am 05 Sep 2011
Copy link to clipboard 
Print this post

Hi guys, just got 2.5c working with the GPS, although I can see GPS data on buddy. Can someone help me with the code to extract Lat Long. Dave
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 06:56am 05 Sep 2011
Copy link to clipboard 
Print this post

Dave,
I need to do exactly the same. I was waiting for Geoff's serial to be completed. I'm OS at the moment. I haven't got my MM with me or any of my notes but it's a fairly easy task to "Parse" ie extract the info from the NMEA string. I've gone part the way but won't attempt a solution for you until I get back home and check my notes. Hopefully someone will have a heap of solutions for you soon and I'll be keen to see what they come up with.
What do you mean by buddy?
Trevor
Talbit
 
devigan
Newbie

Joined: 11/08/2011
Location: Australia
Posts: 26
Posted: 07:22am 05 Sep 2011
Copy link to clipboard 
Print this post

sorry what I meant was putty terminal
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 01:31am 06 Sep 2011
Copy link to clipboard 
Print this post

Dave,
I see no one has answered your request so I'll have a go from memory. First I assume your NMEA string looks something like this...
$GGAXXXXXXXX22.1462S,196.8194EXXXXX
First thing is to make it a string by saying something like
String$="$GGAXXXXXXXX22.1462S,196.8194EXXXXX"
Then you do something like LAT$=MID$(13, 8)
The 13 is the position of the first LATITUDE character (2) and you select 8 characters. LAT$ should then be equal to 22.1462S
You do the same for the LONGITUDE
LONG$=MID$(22, 9)
LONG$ should then be equal to 196.8194E
Remember, I'm going by memory!
Hopefully someone will come alone and clean up my attempt!

Regards
Trevor

Talbit
 
sparkey

Senior Member

Joined: 15/06/2011
Location: Australia
Posts: 819
Posted: 02:22am 06 Sep 2011
Copy link to clipboard 
Print this post

there is better hex code avaliable go to the 2,5c thread and get an update of 2.5"f" its better than "c" regards sparkey

its link is on page 8 of the maxi 2.5c i/o thread 2.5f.zip
Edited by sparkey 2011-09-07
technicians do it with least resistance
 
devigan
Newbie

Joined: 11/08/2011
Location: Australia
Posts: 26
Posted: 04:59am 06 Sep 2011
Copy link to clipboard 
Print this post

Hi guys, I have 2.5f loaded. But my problem to how do you grap the String$="$GGAXXXXXXXX22.1462S,196.8194EXXXXX" from all sentence the GPS is spitting out every hz. Dave
 
sparkey

Senior Member

Joined: 15/06/2011
Location: Australia
Posts: 819
Posted: 05:12am 06 Sep 2011
Copy link to clipboard 
Print this post

find a data logging program you might try silicon chip web site or if you have some older sil chip mags u may find something there you might have to wait till otheres get back tonite they may have some ideas for you,...regards sparkey
technicians do it with least resistance
 
trippyben

Regular Member

Joined: 26/06/2011
Location: Australia
Posts: 91
Posted: 10:38am 06 Sep 2011
Copy link to clipboard 
Print this post

I've only done it in assembly and C, but here's (basically) the steps I took.

Use interrupts to trigger each time a character is received.
1) Sample and store each character in an array
2) When the $ character is found, reset the array pointer.
3) The NEMA strings are terminated by a CR and LF character. Detect either one, or both (whatever suits) and signal to external routines that the array is full and ready to be sampled.

The main routine can loop around doing what ever is needed. When the array full flag is set, it can check the data in the array.
1) Test data string by comparing the GPGGA, GPGSV etc.
2) If the required string is in, further process the array.
Be aware that the length of each string will vary depending on the sat lock status and that character counting functions won't work correctly as a result. The comma characters are place holders and are always present in the string even if the data between is missing. A more relaible way of getting the data you want is to count commas and then sample the data you need, terminated by the next comma.

It may also be eaiser to turn off the unsued output strings during GPS module initialisation. There's a few on-line NEMA string checksum calcuators to help with getting the required checksum for your desired command string.

2011-09-06_203340_NMEA_commands.pdf

 
devigan
Newbie

Joined: 11/08/2011
Location: Australia
Posts: 26
Posted: 10:50am 07 Sep 2011
Copy link to clipboard 
Print this post

Thanks for the info Trippy, Any progress with your GPS Project talbit. I am still at the gate. The GPS spits out data on the Console mode but nothing in the program mode.
ie I hope to see something in the terminal but it is blank
100 OPEN "COM1:4800" AS #5
200 Print #5 "$PSRF103,4,0,1,1*21" ;
300 Data$ = Input$(50, #5)
400 Print Data$
500 Data$ = ""
600 Goto 200
can anyone help Dave
 
trippyben

Regular Member

Joined: 26/06/2011
Location: Australia
Posts: 91
Posted: 11:31am 07 Sep 2011
Copy link to clipboard 
Print this post

One thing to check: Make sure that the print command terminates the string with a CR and LF character so that the GPS module will receive it correcty.
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 01:56pm 07 Sep 2011
Copy link to clipboard 
Print this post

Dave,
Trippyben has made some interresting points that I'll need to look at.
I'm trying to download my program a friend has emailed me. Not an easy task in this location (Cocos Keeling Islands). But I was going to say to you to save the NMEA string as a String$ but it looks like you have tried that. If you can't print out the string then something is wrong somewhere.
Almost there - My colleague is trying to get it from her laptop to mine so that I can do a cut and paste.
There now !!!

10 ''''''''''' 29 July 2011'''''''''''''
1000 GOSUB 11000 'Initialise the LCD
1010 LCD_line1$ = " Waiting for "
1020 LCD_line2$ = " Satellite Fix "
1030 GOSUB 12000 ' Send to the LCD
1040 PAUSE 5000 ' Wait for 5 seconds
1050 t$ = "$GPRMC,235830,A,3520.6098,S,14909.4911,E,000.0,000.0,150711 ,012.4,E*6A"
1060 GOSUB 2000 'Set the PPS & Time Break pins
1070 GOSUB 2500 'Parse the time and date
1080 GOSUB 3000 'Update the time by 1 second
1100 IF PIN(17)=0 THEN 1120 'Wait for PPS to go low then send time to LCD
1110 GOTO 1100 'Loop back if it's not low
1120 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''
1130 IF Day =1 THEN 1510
1140 IF Hour =1 THEN 1550
1150 IF Minute=1 THEN 1590
1200 GOSUB 12000 'Send to the LCD
1210 GOTO 1080
1220 END
1500 '''''''''''''''''Time Break Interupts'''''''''''''
1510 PIN(18)=1 'Day Time Break (6 seconds)
1520 SETTICK 6000,2250
1530 GOTO 1200
1540 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
1550 PIN(18)=1 'Hour Time Break (4 seconds)
1560 SETTICK 4000,2250
1570 GOTO 1200
1580 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
1590 PIN(18)=1 'Minute Time Break (2 seconds)
1600 SETTICK 2000,2250
1610 GOTO 1200
2000 ''''''''''''Routine to set the PPS & Time Break pins''''''''''''
2010 SETPIN 17,2 'Make Pin 17 a digital Input (PPS)
2020 SETPIN 18,8 'Make Pin 18 a digital output (Time Break)
2030 PIN(18)=0 'Make sure Pin 18 is low
2040 RETURN
2250 ''''''''''''''''''''''''''Reset Time Break'''''''''''''''
2260 PIN(18)=0
2270 SETTICK 0,0
2280 IRETURN
2500 '''''''''''''Parse Time & Date'''''''''''''''''''''''''''
2510 parse$ = MID$(t$, 1, 1) 'Get the first character
2520 parse6$ = MID$(t$, 6, 1) 'Get the sixth character
2530 IF parse$ <>"$" THEN 1640 'Test for $, stop if it's not
2540 IF parse6$<>"C" THEN 1640 'Test for $PGRMC, stop if it's not
2550 hh$ = MID$(t$, 8, 2) 'Get the hours
2560 mm$ = MID$(t$, 10, 2) 'Get the minutes
2570 ss$ = MID$(t$, 12, 2) 'Get the seconds
2580 dd$ = MID$(t$, 54, 2) 'Get the days
2590 ll$ = MID$(t$, 56, 2) 'Get the months (ll=months)
2600 yy$ = MID$(t$, 58, 2) 'Get the years
2610 ss = VAL(ss$) 'Change time to an integer
2620 mm = VAL(mm$)
2630 hh = VAL(hh$)
2640 RETURN

That's the best I can give you at the moment. The rest is probably not of any interrest to you.
Ignore most of the program because it's only at testing stage.
But I start with a dummy NMEA string at 1050. I check to see it's the correct string at 2500 then I Parse the time and date then display it on the LCD on the GPS PPS. If you can work out how to get the NMEA string so that you can manipulate it then you should be half way there. I'm keen to know what you come up with.
Hope this is of some help. I'm 3.5 hours behind Sydney time.
Trevor


Talbit
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 02:12pm 08 Sep 2011
Copy link to clipboard 
Print this post

I presume your line 200 is setting the GPS up to output a particular NMEA sentence. You should only need to do this once after startup. So maybe you should loop back to line 300 instead of 200.
Also , in Geoff's example he has a comma after the Print #5 so line 200 should be
200 Print #5, "$PSRF103,4,0,1,1*21" ;

What's the ; at the end of line 200 for?
And is line 500 to reset Data$ to blank?
I'm not sure if you need to do this.

Try and simplify it by doing just one read...


100 OPEN "COM1:4800" AS #5
200 Print #5, "$PSRF103,4,0,1,1*21"
250 Pause 2000 'wait 2 seconds
300 Data$ = Input$(50, #5)
350 Close #5 'Close the port
400 Print Data$ 'See if it's there.
500 End

If you succeed in seeing the NMEA string at line 400, then you are almost there.

I'm itching to get home and get mine going.
Trevor
Talbit
 
devigan
Newbie

Joined: 11/08/2011
Location: Australia
Posts: 26
Posted: 11:08pm 08 Sep 2011
Copy link to clipboard 
Print this post

Tried your code I am getting a blank line. how about you
 
devigan
Newbie

Joined: 11/08/2011
Location: Australia
Posts: 26
Posted: 11:14pm 08 Sep 2011
Copy link to clipboard 
Print this post

I tried even with line 200 remove still the same
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 05:53am 09 Sep 2011
Copy link to clipboard 
Print this post

I can't try anything because my MM is 6000klm away. I'm going on my general knowledge with nothing to try it on.
Sorry.
I'm amazed that you haven't been swamped with offers of help.
Come on guys. Help this bloke out !!!
Talbit
Talbit
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 07:07am 10 Sep 2011
Copy link to clipboard 
Print this post

Dave,
I've had a closer read of Geoffs notes on the serial. The way I understand it, when you open the serial port it accepts anything that comes along and puts it in the buffer. Then you read the buffer with data$ = input$(50, #5). Then to look at it you
Print Data$
So when you do data$ = input$(50, #5) you're not actually looking at the port, but you are extracting data from the buffer.
But the program you have tried below should wait for some data to be in the buffer but as you have said you still can't see anything. Can you try the EOF() command to see if there is actually anything there? See Geoffs notes.

100 OPEN "COM1:4800" AS #5
250 Pause 2000 'wait 2 seconds
300 Data$ = Input$(50, #5)
350 Close #5 'Close the port
400 Print Data$ 'See if it's there.
500 End

I'm assuming you have your GPS connected to pin 15. It can't be any higher than 5 volts. But check that you are allowed to go as high as 5 volts or does it need to be 3.5volts. I hope you haven't zapped pin 15.
Next thing to try is to invert the NMEA stream before you feed it into pin 15.

Next you can try this routine...

100 OPEN "COM1:4800, 100, 10000, 50" AS #5
300 print data$
400 end
10000 close #5
10100 data$ = input$(50, #5)
10200 Ireturn

This uses an interrupt but it should only branch to the interrupt if it receives 50 characters into the port.
Trevor




Talbit
 
     Page 1 of 2    
Print this page
© JAQ Software 2024