07-17-2014 03:07 PM
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.
07-17-2014 03:25 PM - edited 07-17-2014 03:26 PM
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.
07-17-2014 03:25 PM
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.
07-17-2014 03:58 PM
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.
07-18-2014 01:14 AM
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).