03-21-2007 05:44 AM
03-21-2007 05:54 AM
They run as two seperate threads.
Tom
03-21-2007 05:59 AM
Ok, thanks.
I am using a DAQ USB 6008 unit.
One of the while loops reads analogue inputs from the device, and the other writes/reads digital IO.
Do you know if the program could crash if both while loops tries to communicate with the 6008 unit at the same time?
/Stephan
03-21-2007 06:10 AM
03-21-2007 06:10 AM
First, Let me say I don't know the answer! (Someone else may comment with more knowledge of your setup). My gut feeling is no. Reading the analog inputs will occur and doesn't hurt the other function. Reading/writing of DIO will happen when required. The only risk I see is maybe a missed message -- if you have requested a read with one loop and the DAQ is busy getting that info while the other loop then tries to write -- you may miss the command. Although the unit probably has a buffer to hold the request until it is no longer busy --so the risk is probably low or not a risk at all. I would recommend watching for this and make sure that you receive all the reads and the DAQ executes all the writes that you command.
Tom
03-21-2007 08:38 AM
As long as the loops have no wires connecting them, they will run in parallel. If you have any wires running from one to to the other, the loop that has wires running out of it will run first. When it finishes, the other loop will run.
DAQmx allows multithreaded access to DAQ devices. In other words, you can access the IO resources of the device from multiple places in your application. The one exception to this is the analog inputs on the majority of DAQ cards. The analog inputs all share a single "resource" on the card because they share a single analog to digital converter and the channels are sequentially scanned in the order they are setup in the task.
This means you can have one loop accessing the analog inputs and another loop accessing the digital lines. But you cannot have two loops accessing the analog inputs. (well, you can but you have to configure the task, acquire data, close the task, configure in the other loop, acquire, close, rinse and repeat...)
Ed

Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.03-21-2007 09:59 AM