09-03-2013 02:47 PM
Hi,
I'm wondering about the best way to create subVIs that do repeatitive analog input and digital output multiple times in a program. Specifically, should I create a new task using the DAQmx Create Channel function in the subVI or should I create the task in the main VI and pass the task into the subVIs? Would creating and clearing a new channel in a subVI affect the digital output line states (eg change a DO line to default state) after the program exits the subVI?
I'm going to collect 6 channels of analog inputs and use 2 digital outputs to control a magnet. The program only collects analog inputs for 5 seconds at a time (based on user selections), and turns the magent on or off based on the analog input.
I'm updating an old LV program that used the traditional DAQ functions to use the new DAQmx functions. The old program was written in LV 8.6 and used the DAQCard-6036E and I'm updating it to LV 2013 and the USB-6212 mass terminal device.
Thanks,
Frank
Solved! Go to Solution.
09-03-2013 03:46 PM
For example, this is subVI would turn the magnet off. Should I get rid of the first frame and pass in the (task in) ID from the main VI?
09-03-2013 04:15 PM
If you are calling this VI a fair amount, then I would create the task beforehand and pass it in. Recreating the task is just asking for trouble, especially since I don't see you closing it either.
09-03-2013 04:34 PM
Thanks, it is called a few times so I'll create it in the main VI. I forgot to throw in the close function 🙂