From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using two analog modules together in LabVIEW FPGA

Hello everyone,

I am using NI cRIO 9014 along with the NI 9104 chassis. I am using two analog modules (NI 9219 and NI 9229) to get data from different sensors. I want both the modules to work parallelly so that I can get real-time data from my sensors.

I have made the following FPGA program (see attachment). The problem is when I am using both modules the data is lagging and output is not accurate. I have tried to create individual programs for each module which works well but together data lagging can be noticed. My guess is, this is something for the data rate of the modules but I am not sure what data rate I should give or how should I resolve this problem.

 

Please let me know how I can make these two modules work parallelly. Thanks in advance.

Download All
0 Kudos
Message 1 of 6
(1,028 Views)

I'm not sure what you mean by "data is lagging" but here's what I would do: I see you are opening the FPGA reference two times and keep two separate wires for the same reference. I have never done that, I don't know how LabVIEW is handling this. I would open FPGA reference once, write all the FPGA controls and then start both loops in parallel. When both loops finish, close the FPGA reference (so one wire of the FPGA ref). Also, try to remove the TDMS functions in both loops and see if that changes anything.

Lucian
CLA
0 Kudos
Message 2 of 6
(988 Views)

Why do you read 2000 elements in the first while loop but ignore the data? I think you should specify a value of 0 for the first read only to get the number of available elements.

Lucian
CLA
0 Kudos
Message 3 of 6
(979 Views)

Hello,

 

Thank you for your reply. I followed two examples of LabVIEW for NI 9219 and 9229. I have used two references because in two examples they have different elements and I didn't know how to combine them with one reference VI. I have attached a picture to explain it clearly. If I have to use only one reference VI, please let me know how would I make changes for invoke method and read/write control.

 

I meant by ''data is lagging'' is its taking time to load data in the waveform chart.

 

 

0 Kudos
Message 4 of 6
(940 Views)

Hello,

Thank you for your reply. I kept 0 for the first loop. But after that, I was getting data only from the first loop. From the second loop I was getting no data.

0 Kudos
Message 5 of 6
(937 Views)

. If I have to use only one reference VI, please let me know how would I make changes for invoke method and read/write control.

 

I meant by ''data is lagging'' is its taking time to load data in the waveform chart.

 

 


Place the Open FPGA VI Reference and unselect Run the FPGA VI checkbox. Write all the needed FPGA controls and then call the Run method. After this you can split the FPGA ref wire and connect it to both loops. When both loops finish execution, call the Close FPGA VI Reference.

By reading the detailed help of the Open FPGA VI Reference I understood that it is allowed to open more than one FPGA reference if they correspond to the same VI. However, I think it's not a good practice to do so.

Your "lagging" could be related to the combination of sample rate and number of elements read at once from the DMA. If the sample rate is too low it might take a while until 2000 samples are generated and the graph displays new data.

If lag effect is seen only when measuring from both modules, it could also be related to the low performance of your cRIO. I see that you use a really old one with a single core 400MHz and 128MB of RAM. Did you check the usage of these resources while your program is running (with Distributed System Manager for example)? What version of LabVIEW do you use?

Lucian
CLA
0 Kudos
Message 6 of 6
(915 Views)