# student with not enough info

Status
Not open for further replies.

#### karenthestudent

##### New Member
hi,
I hope im in the right place? I am just starting a project using PIC to control a GPS chip and a digital compass. The coding between the two is likely to be hard, i have only got them sending information to the computer at the moment. Woud there be anyone on this site that would know about this sort of thing, and be able to help?
karen :?:

#### stevez

##### Active Member
Karen - what is a GPS chip?? Global Positioning System comes to mind and fits in with the digital compass. Is the digital compass something you made or purchased? I'd like to know more. FYI - I am at the very bottom of the PIC learning curve.

Thanks.

#### karenthestudent

##### New Member
hi,yes GPS is global position system. The main problem I have is with the code for it as I say. I am using two GPS devices which i need to talk to compare the positions from. When it does, I obtain a direction in terms of North south etc, of how to get from one device to the next.
would you anything about this, or know of anyone or anywhere I could go to get help from?
karen :?

#### phalanx

##### Member
Karen, could you send some more information about the GPS modules you are using? Most importantly the interface that they use. I know of a number of modules that output ASCII via a serial link. If that is what you are using, the interface and coding to get an individual unit to work isn't all the difficult. I like the idea about using 2 to get a direction while you are in a static position though!

#### Noggin

##### Member
http://www.electro-tech-online.com/custompdfs/2003/12/finaldesigndoc.pdf

That is a group that is building a GPS receiver, don't think they have gotten very far with it though. You might want to send one of them an email and see if they respond, they might even have some code to give to you for an Atmel processor. Even if you can't use it, you might be able to go through it and see if there is anything you could use

#### Eclipsed

##### New Member
I have quite a bit of experience with PICs,various GPS modules and GPS in general.What do you need help with? What type of GPS receivers are you using?

#### karenthestudent

##### New Member
hi
Ill try and explain more, I am very much at the beginning of my progress.
I am using a Garmin GPS35 which uses RS232 as an output. I have had the GPS plugged in and sending information to hyper-terminal. This then displays the default settings over and over, which are GPGSA, GPGSV, GPRMC and GPGGA. I need to send this information through the PIC. So I am using a Max238 to step it down to TTL levels, from RS232. This is where the problem starts, I am trying to get the PIC to read information from the device. I need some code to tell it when and what to send information to the computer. This is where I am at present if anyone feels they could help please let me know.
karen

#### Eclipsed

##### New Member
So you're having a problem with your code reading the NMEA data? Are you trying to use the PIC to filter the data before it is sent to the computer? You can just send NMEA commands to the GPS unit and tell it what info to send, What info not to send and how often to send it.Also, you do know that the data is sent in ASCII right?

#### karenthestudent

##### New Member
yep,I have the GPS going through pic, using Simpic to display all the characters. At the moment it constantly sends data from the gps. I only need one of these data lines, so I need a way of stopping it, and then requesting one line. I have downloaded that data sheets for it from Garmin. Although the data lines it details dont work as far as I can see. I have tried many different variations. I would contact Garmin direct, but as there in the US, its a bit hard for me. All I basically need is the off command, and then the request GPMRC data line, from which I get a location and time.
Any ideas of how to get this informtaion? when I have done this then I can start comparing the lines of data in order to try and find a direction between the two locations.
karen

#### Eclipsed

##### New Member
First of all, make sure you have the garmin technical specification for the gps35, this is different from the datasheet and the quick start guide.The NMEA 0183 document would be helpful to you too, it costs money to get it from NMEA,but if you do a search on google you can find it for free.This is the standard in which nearly all GPS units communicate,it details the NMEA sentence structure and baudrates, etc.The usual problem with communicating with GPS recievers is the ASCII format.
Make sure you send the "$" Followed by the command "PGRMO" Then a "," Then the output sentence you want to disable Followed by "," Then a "0" Followed by a carriage return and a linefeed,All in ASCII characters at the default 4800 baud.It will echo back exactly what you sent, if it echos back something different, there was an error in what you sent.This will disable the output sentences one by one, leave the "$GPRMC" command,this will contain your position and time info.It will output the $GPRMC every second at 4800 baud.You can also change the baud rates and how often the sentence is transmitted, by the "$PGRMC" and "$PGRMC1" commands.Or you can turn off the "$GPRMC" too, and re-enable it every time you want location and time info.

#### karenthestudent

##### New Member
Thanx.
The commands I have been using from garmin site, are...
$PGRMO,<1>,<2>*hh<CR><LF> where <1> target sentence description <2> sentence mode... 0= disable specified sentence 1=enable specified sentence 2=disable all output sentences 3=enable all output sentences I want to disbale all outputs, and then enable GPRMC only. I have tried using$PGRMO,,2 to disable all and \$PGRMO,GPGGA,0 to disable one at a time. Maybe I am missing something,but as far as I can see it i have put in all combinations and they dont see to work. The information is deffiantly sending to the GPS??

#### Nigel Goodwin

##### Super Moderator
If it's any help, I've just bought the UK Magazine EPE today, it includes an article about interfacing GPS to PIC and PC - you can subscribe to a cheap downloadable version at http://www.epemag.com/. You can download the software (both PC and PIC) from their UK site, there's a link at the above URL.

#### Eclipsed

##### New Member
Does it echo back what you send to it?

#### karenthestudent

##### New Member
im not sure sorry. (as far as I know, no)

#### karenthestudent

##### New Member
any ideas?

Does anyone know of anyway I could get help with this GPS project?
I am really stuck, I have all the data sheets from Garmin, but they say to do exactly what I already tried to do.

#### Nigel Goodwin

##### Super Moderator
Re: any ideas?

karenthestudent said:
Does anyone know of anyway I could get help with this GPS project?
I am really stuck, I have all the data sheets from Garmin, but they say to do exactly what I already tried to do.
Hi, you've already mentioned that you have it connected to your PC via HyperTerminal, can you control it as you wish from HyperTerminal?.

If so, you obviously know which commands you need to send - if not, get it all working with HyperTerminal before you try and move to the PIC.

Once that's all working you can try the PIC, confident in the knowledge that you know exactly what to send - and that the GPS unit works correctly.

#### karenthestudent

##### New Member
yep, I have had it working through hyper-terminal, and sending all four lines from the gps. I am also certain that it is sending commands to the GPS. I have connected the GPS to PIC now, and I also have it receiving data. Although the problems start when I try to send commands such as stop sending etc. The commands are correct according to the data sheets I have from Garmin, although they just dont seem to work. Maybe I am missing something simple, but I just cant see it?

#### Nigel Goodwin

##### Super Moderator
karenthestudent said:
yep, I have had it working through hyper-terminal, and sending all four lines from the gps. I am also certain that it is sending commands to the GPS. I have connected the GPS to PIC now, and I also have it receiving data. Although the problems start when I try to send commands such as stop sending etc. The commands are correct according to the data sheets I have from Garmin, although they just dont seem to work. Maybe I am missing something simple, but I just cant see it?
You say that you are 'certain that HyperTerminal is sending commands to the GPS' - that sounds like you don't actually know!.

Use HyperTerminal to send the commands you want to the GPS, and make sure that it reacts as you wish - there's no point in being 'certain' if you haven't actually done it.

#### Eclipsed

##### New Member
Unless you can figure out a way to read the echo, I don't know what to tell you.I recommend connecting to RXD1 line to the PIC and the TXD1 to Hyper Terminal.Have your PIC send a command and Hyper Terminal read the echo, this will narrow down your problem.

#### karenthestudent

##### New Member
it works!

Hi,
Thanx all, it works, I had my asci characters length wrong. I now have it sending PGRMC as required.
Now I have another question...
Does anyone know of where to get micro chip code that would allow me to calculate the tangent of an angle?
If anyone has an suggestions please let me know.

Status
Not open for further replies.