04-17-2013 12:39 PM
hammer3 wrote:Besides, even if I did previously define tasks, shouldn't this vi overwrite and supercede previous setups?
Nope. What that function does is add channels to the task. So if you already have a task defined with a channel, you are just adding more channels to it.
04-17-2013 01:06 PM
OK. How do I OBLITERATE all previously existing tasks and create a NEW one programmatically?
04-18-2013 05:59 PM - edited 04-18-2013 06:02 PM
The task input to DAQmx Create Channel is optional--if you leave it unwired a task will be implicitly created when you create a new channel.
Alternatively, you could use the DAQmx Create Task function to explicitly create a new task programmatically:
If you're not using global virtual channels, you would really only need to call DAQmx Create Task if you needed to turn off auto cleanup (in the oddball case where you are creating tasks from an asynchronously called subVI that leaves memory when your application is still running). Or, perhaps you are creating channels inside a loop using a shift register and want to intialize the shift register with an empty task.
Giving the task a descriptive name can also be useful for debugging purposes (e.g. using NI IO Trace) if you have multiple DAQmx tasks running at once.
Best Regards,
04-19-2013 07:13 AM
Thank you all for your inputs, but I still find it all quite confusing. Is there a document that fully describes DAQmx in its entirety rather than having to search through Help files, which requires having to ask the right questions? I gave up trying to use the lower level, more efficient vis and successfully used the DAQ Assistant.
04-19-2013 11:36 AM
Other than the DAQmx Help, you might want to check out the article Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications, or refer to the shipping examples (From LabVIEW, Help>>Find Examples...>>Hardware Input and Output>>DAQmx).
At the end of the day, the DAQ Assistant isn't necessarily less efficient than the lower level API--it's just a bit less flexible.
Best Regards,
04-19-2013 12:07 PM
Thank you MUCH for that article. That DOES cover a lot of important info.