LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

parallel while loops not running in parallel

I am collecting data from a PCI 4351 board and a 6070E board. These are connected to a TC 2190 and a BNC 2090. I do not need exact sychronization, however I do need them to collect data at different rates. Currently I am using two while loops to perform this, but they run sequentially in stead of simultaneously, that is, the second while loop waits for the first one to finish before running. Is there any way I can get these to run both at the same time instead of one after the other?
0 Kudos
Message 1 of 5
(3,143 Views)
Your two loops are calling the same SubVI, and that VI is not reentrant, so only one instance can be in memory at a time.  Therefore, one loop will have to wait for the other loop to release control of the AI Read before it can access the AI Read.
 
One option is to save AI Read as something else (maybe in your user.lib) and make it reentrant, but it actually calls AI Buffer Read which also uses non-reentrant VIs.  I would suggest looking at your timing to see if you can make it as exclusionary as possible.
0 Kudos
Message 2 of 5
(3,131 Views)
Thanks for the reply, is there a better way to accomplish what I am trying to do? I was thinking maybe using a sequence and switching off between the two.
0 Kudos
Message 3 of 5
(3,122 Views)
Any way you do it, you're going to have to sequentially read from the data buffer, and the implementation you have now may be the fastest, if not the most accurate.  I would recommend that you either put a wait statement in each loop if the two data reads need different timing, or just wire the error cluster from one's output to the other's input and have them both in the same loop.  At least that way you are always certain which is executing before the other.  Also, in the dataflow (wired together) example, I would still recommend a wait statement, just to be on the safe side.  Even if you have a wait of 10 ms it may save you from spinning your loop pointlessly.
0 Kudos
Message 4 of 5
(3,113 Views)
Thanks for the help!
0 Kudos
Message 5 of 5
(3,094 Views)