LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running nested while loops. Data Acquisition & Generation in parallel from the same DAQ

Hello,

I'm having a problem running my VI that has two while loops.

Okay, originally  I had two seperate VIs, one that generates a PWM signal from the DAQ, and another that acquires 2 signals from two pressure transducers. These VIs were working perfectly when run as seperate VIs at the same time, but I'm required to integrate them into one VI.

I just want to run the two while loops in parallel at the same time from one VI; I want to acquire data from the transducers and generate the PWM from the DAQ (NI USB-6211) using the same VI.

 

I tried placing the two while loops next to each other, but the program just won't work. Then I placed them as nested loops, and it won't work either.

Please find the VI attached.

I really hope someone will be able to help, I just want to run the two while loops at the same time; they're independent. I'm not looking for something that's complicated and that involves timing, I'm not really experienced with labview.

 

Thank you very much.

0 Kudos
Message 1 of 5
(2,801 Views)

Hi Lab,

 

nesting the loops will not work due to DATAFLOW! Think DATAFLOW!

 

Running them in parallel should work as long as you don't have data dependencies AND there is no problem with those DAQmx tasks.

What exactly was the problem when you tried to place them in parallel? Saying "just won't work" doesn't explain the problem very well…

 

Do yourself a favor and replace those ExpressVIs by "real" DAQmx functions after you read this.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(2,795 Views)

What do you mean by "doesn't work".  How is it not working?  Are you getting any errors?

 

Just having the two loops as completely seperate loops should work.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 5
(2,794 Views)

I'm sorry I didn't clarify it the first time. What I meant when I said it won't work is that the data I observe on the chart and graphs aren't like what I observe when the while loops are placed in seperate VIs and run independently.

There aren't any errors. But for example, the Sqaure chart should show me the PWM square signal being plotted vs time, like what happens when this exact same loop that generates the square signal is run in a VI alone.

Instead it hust starts showing blank white space.

The graphs plotting the reading from the pressure transducers just show weird noise signals.

 

Please find the VI attached. Can anyone please help.

Thank you very much.

0 Kudos
Message 4 of 5
(2,779 Views)

Actually its not white space, the frequency of the Digital signal is higher - 100Hz and in a time frame of 5 seconds you will get 500 pulse which will look like white space (You don't believe me, use the zoom tool in graph palette and check it 🙂 ). If you want to see the pulse signal, you may have to decrease the time in the X axis (may be in ms) of the digital pulse train display else reduce the frequence (may be 1 Hz).

-----

The best solution is the one you find it by yourself
Message 5 of 5
(2,758 Views)