NI Home > Community > NI Discussion Forums

Real-Time Measurement and Control

Reply
Member
hema
Posts: 105
0 Kudos

how to make continuous data acquisition using compactRIO NI 9237

Hi
 
I have 2 doubts. The first is that i am measuring force using load cell connected to NI 9237 and compactRIO controller is NI 9104.
I have run the example VI which is found in the CompactRIO /module specific 9327 Getting Started project.
When i run the host VI, the VI just runs once and stops. that is it gives 4095 samples which is specified in the VI . So when i apply force, i see the 4095 values in one shot and the VI stops. I want the VI to run continuously. I should be able to see the values changing as the force is varied. how should i do this.
 
Secondly, i have to integrate this cRIO NI 9237 with NI  cRIO NI 9215 (9215 reads from LVDT) . Shoould I use just one FPGA target VI and call both module Analog inputs in the same place/sequence. or should the AI nodes be place in different places.
 
i am new to LabVIEW Real Time, so i need some info on the interrupt and synchronization part , any info links on this would help.
 
 
thank you, Hema 
Member
Yi Y
Posts: 187
0 Kudos

Re: how to make continuous data acquisition using compactRIO NI 9237

Hi Hema,
You can modify the FPGA code in the NI 9237 Getting Started (FPGA).vi, and put the data collection in a while loop to collect data continuously.
You can only run one FPGA program at once, so you can only have one main VI under your FPGA target.  Where to put your AI nodes is up to the architecture in your program, but everything has to be called from the main VI on your FPGA target.
If you are new to FPGA, the LabVIEW FPGA help is excellent, and you can get a lot of information from there to get you started.

Yi Y.
Applications Engineer
National Instruments
http://www.ni.com/support
Member
hema
Posts: 105
0 Kudos

Re: how to make continuous data acquisition using compactRIO NI 9237

Hi Yi Ya,
Thank you. I put in while loop and am getting continuos data. I have to integrate NI 9237(measuring force) and NI 9215(measuring position) cRIO modules in my FPGA VI. I want to put both module analog node in common while loop and set update time as common. Can that be done? I also want to store the data that is read from both modules and store them in a text file with Timestamp. I want to read from the file and plot the two graphs. Do i have to use FIFOs for this? The data storing in File and plotting should not  be affecting the acquistion rate of the modules. how to do this.
thanks a lot.
Hema
 
 
 
Member
MeghanK
Posts: 156
0 Kudos

Re: how to make continuous data acquisition using compactRIO NI 9237

Hi Hema,

You can integrate both your NI 9237 and your NI 9215 in one FPGA VI.  Once you add both of your modules and FPGA I/O to your project, they should both appear when editing an FPGA I/O node on your FPGA VI. 

The best way to store your data to a text file with timestamps would be to write your data to a shared variable in a high-priority acquistion task, and then read your data from the shared variable and write it to a text file in a low-priority acquisition task (See Figure 12 of the first article linked below). 

FPGA Design, Development and Programming Tutorial

I would also recommend that you use a DMA FIFO to transfer your data efficiently.  Please read the Developer Zone article below for more detailed information on using DMA FIFOs, in addition to LabVIEW Help.  Thanks!

Using DMA FIFO to Develop High-Speed Data Acquistion Applications for Reconfigurable I/O Devices

Meghan M.

Member
hema
Posts: 105
0 Kudos

Re: how to make continuous data acquisition using compactRIO NI 9237

Hi Megan, Thanks for the info. The FPGA module data has to be plotted with respect to timestamp.

when i plot the data with timestamp as x-axis, that is , i have a while loop in the host VI which runs on the RT. i have not specified any time delay in host. The timestamp on the chart does not come correct. My FPGA loop rate is set in micro secs.

The timestamp has to be the RT controller timestamp. how do i set the time correctly.

Does plotting put overhead on the execution time.Thanks.

 

Member
MeghanK
Posts: 156
0 Kudos

Re: how to make continuous data acquisition using compactRIO NI 9237

Although the FPGA processes data on the order of microseconds, the RT operating system has a determinism of 1ms.  Therefore, you will not be able to read timestamps on your host VI in ranges of microseconds.  You can determine the delta t of your data acquisition by setting the sampling rate using an FPGA I/O Property Node on your FPGA VI.  I suggest that you look at the LabVIEW shipping example titled NI 9237 Getting Started to see how this is programmed.
 
Meghan M.
Member
Nick Kimber
Posts: 7
0 Kudos

Re: how to make continuous data acquisition using compactRIO NI 9237

Hi,
 
I am interested in this thread becuase I have to integrate a 9205 (AI), 9263 (AO) and a 9237 (strain) on a cRIO (9104) for continuous acquisition (50 Hz)
 
The 9205 and 9263 appear on the FPGA Wizard, but the 9237 does not. As mentioned earlier in this thread, the Getting Started example does not do continuous acquisition - but I understand the suggestion to use a while loop.
 
I wouldn't normally use DMA for the AI/AO - do I have to for the 9237?
 
Any chance of an example of how best to setup all three modules in one FPGA?
Member
Yi Y
Posts: 187
0 Kudos

Re: how to make continuous data acquisition using compactRIO NI 9237

Hi Nick,
Not every module is currently supported by the FPGA Wizard.  However, you have access to all the modules in the project explorer.  After you create the cRIO target and add the FPGA (9104), you can create 3 C-Series modules with different AI/AOs set up.
Since you are acquiring at 50Hz (that's very slow), read/write control would be sufficient way to transfer data from your FPGA to your cRIO controller, even though DMA FIFO is easy to set up, fast and reliable.
Depends on your needs, there's not really a "best" way to set up the AIO.  I would recommend a sequence structure with the first frame acquiring the calibration data, second frame sending the IRQ to the host to make sure calibration data is ready to be used and third frame running a while loop timed with FPGA timing VIs and doing necessary I/O.  If you are using Read/Write control instead of DMA FIFO, it's probably a good idea to set up a handshaking mechanism to inform the host side when data is ready to be acquired.

Yi Y.
Applications Engineer
National Instruments
http://www.ni.com/support
Member
Nick Kimber
Posts: 7
0 Kudos

Re: how to make continuous data acquisition using compactRIO NI 9237

Thanks Yi

I have used the code generated by the FPGA Wizard for the 9205/9263 and then copied blocks from the 9237 Getting Started example into a similar structure, so I've got something working even if it's not the "best". I'll ask my local NI engineer about DMA when he next visits.

And hey, speed is relative! :smileyhappy:

Nick

Member
Hemagopal
Posts: 20
0 Kudos

Re: how to make continuous data acquisition using compactRIO NI 9237

Hi,

Did you have to use any sort of filtering for the signals read from the FPGA. I am reading LVDT outpu volts thru NI 9215 and CRIO module.

When the LVDT is at a fixed position, i want the voltage read in my VI as constant to six decimal places. But that is not happening. I have the data rate of 9237 set as 50Khz and integrated both modules. (using NI example 19237 module). My voltage value at a fixed position flickers that is if voltage is 2.00 v,

my readings is not constant after 3decimal  places. Checked for the connections and that looks OK.

thanks.