Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading GPS data from a cRIO

Solved!
Go to solution

Thanks a lot Rob,

 

That really helped. Smiley Very Happy

And about the lot of data writing and the indicators, this is kind of a research project where we dont want to miss out on any data or leave any signal processing not tried on it. .:P

 

I will clear it a little maybe once I have the exact requirements of what exactly is "really" needed.

 

Thankyou

Tamanna 

0 Kudos
Message 11 of 52
(3,398 Views)

Hi Tamanna/Rob,

 

I am kinda in a similar situation. I am using 9014, 9221 module and using 7475 modules running independently. Now I want my GPS data to come and join the data file. One engineer at NI told me if I want to use the serial port on the controller I needto have a cable going to the computer also?? She suggested buying the 9870 module instead.

 

Tamanna can you please tell the wirring details. Also, any tips on how you figured out separating the string. We will be using some Trimble GPS with standard NMEA string in specific the GGA string is what I need.

 

I have no experience with using VISA, any help!! I would appreciate lot.

 

Thanks,

 

Ajay 

0 Kudos
Message 12 of 52
(3,153 Views)

Hi,

 

The NI people suggested buying the 9870 I donot know what is the deal.

 

Rob, can you please explain 1 thing. Suppose my data would be recorded either at 1 or 10 Hz, and you said earlier to Tamanna that if the GPS is read at 1 Hz too it would only read 1 part of the data?? I could not get that. If i could get the data string, concatenate with the earlier data and put that together and write it in a text file, that will be great.

 

I would appreciate.

 

Ajay

0 Kudos
Message 13 of 52
(3,152 Views)

Hey Ajay, I believe we have talked before.

 

First of all, the 9870 module is NOT necessary. The serial port that is built into the cRIO controller works EXACTLY like the com1 port on your computer. In fact, it even shows up as com1 on the cRIO on the RT side of things.  If you can hook your GPS device to your computer and view the data in hyperterminal, you can do the same thing with the RT Serial port. The 9870 requires FPGA coding and is not for the novice FPGA developer.  The built in port is used with VISA drivers, and there are examples in the example finder that will get you up and running reading your data and putting it on the front panel in no time at all without any FPGA compilation.  I am sorry if the person you talked to said you needed it, we are not in the business of selling components that are not needed.  If you want more than one channel for serial, or you are VERY serious about timestamping and low-level control, then the 9870 may be appealing to you, but for most users the onboard com port will work perfectly.

 

What I was explaining to Tamanna is this...Let's say you have your GPS device at 9600 baud.  In one second, many U8 ASCII characters could be put in the buffer on the module.  This module has a limited amount of space to store what has been sent to it. If we dont 'read' this buffer in FPGA, it will start missing data since the buffer is filling up.  Therefore, the 9870 module has to be read continuously at a very fast rate, so no samples are missed. If we try reading it and no characters are available, it will simply time out and, since we have it in a loop, will try a read again soon after.

 

What you will want to do...is pull in data from VISA and continuously build it up with shift registers.  You will always be parsing this string for your NEMA sentence, most likely starting with $GGA and ending right before the next $.  The reason you want to build the string is in case your VISA read brings in half a sentence.  You do not want to parse out half a sentence, so you check to see if you have a full sentence, if not, read another chunk of data, combine it with what you have so far, and check again for a full sentence.  Once you have a full sentence, great, pull it out, trash the data you didnt need(or even better, find the setting on the GPS device to disable the unused sentences and save processing power, I know Garmin devices can do this)combine it with any other data you are taking, and write to file. It is very straightforward, the only thing you have to think about is somewhat synchronizing the data.

 

Rob K
Measurements Mechanical Engineer (C-Series, USB X-Series)
National Instruments
CompactRIO Developers Guide
CompactRIO Out of the Box Video
Message 14 of 52
(3,144 Views)

Hey Rob,

 

Yes we have talked before, in detail! and you have been instrumental in my earlier success. 

 

I know I may be sounding stupid but what does " You will always be parsing this string for your NEMA sentence, most likely starting with $GGA and ending right before the next $" means and how to do this?

 

I have small example of "Read GPS Time, position, Velocity.VI" example. I will try to work on it, but definitly come back since something came up really fast and I have to deliver within 3-4 days, and will need your help.

 

Appreciate your comments,

 

Ajay

0 Kudos
Message 15 of 52
(3,140 Views)

Hey Rob,

 

I more thing, can you guide me through if i am interested in 9870, since my entire program is using FPGA, lets see if that can be worked out. Also 1) can you suggest how to check whether the string is of correct length, 2) how to parse it?

 

Many thanks,

 

Ajay

0 Kudos
Message 16 of 52
(3,133 Views)

Hi Ajay

 

The module NI 9870 is totally unnecessary, you can hook up the GPS receiver to the serial port of the controller. Rob saved me lot of work just by letting me know that. Only catch here is, to interact with the ports on the controller, the code with your VISA commands should go into the controller and not the host PC. 

 

'Read GPS Time, position, Velocity.VI' is a very good example to start off, pass the GPS data to the host along with your other data and write them together into a file. Only that each data point might not be tagged with a GPS point beacuase of the difference in the sampling rates.

 

Hope this helps 

 

--Tamanna

 

 

0 Kudos
Message 17 of 52
(3,127 Views)

Hi Tamanna,

 

I Have added this part of the program IN my FPGA program, but I am not able to give VISA resource name to it. Its giving me bunch of errors i donot have consumebefore.vi. I donot know what VI is doing. I believe this is the first thing I neeed to have.

 

Probably it will solve other issues.

 

Please suggest.

 

Ajay

0 Kudos
Message 18 of 52
(3,109 Views)

Hi Tamanna,

 

I Have added this part of the program IN my FPGA program, but I am not able to give VISA resource name to it. Its giving me bunch of errors i donot have consumebefore.vi. I donot know what VI is doing. I believe this is the first thing I neeed to have.

 

Probably it will solve other issues.

 

Please suggest.

 

Ajay

 

Hi Ajay

 

The time,position velocity vi which we were talking about in the previous message is a stand alone program which will help you understand the VISA commands better. Make it work and see what exactly is going on there, that will help you use a part of it in your FPGA project. yes, you would definitely need consume before vi to get it running.visa resouce name field on "Visa configure serial port" should give you all the ports available when run. see all the sub vis with your help window enabled (ctrl+h) to understand things better. There is a vi called "findserial61.vi" (file attached) which will give you the names of all the ports available, this will help you learn how serial ports appear when VISA commands are used.

 

In your FPGA project, use the visa configure serial port and invoke a read command on the resource name to read the string. Search for GPGGA or what ever you are looking for in the NMEA message and buffer it using a shift regiter and you can store it in an array.This should be much simpler than than the time position velocity example

 

--Tamanna

 

 

0 Kudos
Message 19 of 52
(3,103 Views)

Ifound this on the NI site when I was looking for some help on GPS stuff. The llb gives you consume before .vi

 

 --Tamanna

0 Kudos
Message 20 of 52
(3,099 Views)