08-28-2009 09:06 AM
Hi,
I am using NI-DAQmx in visual basic to scan 8 channels on a Windows timer and I am trying to separate out initialisation code from the code to perform the scan.
The example code lists all the functions I need to call in sequence, but its not clear which function I can call once (during intialization) and which functions I need to call to do the scan and get the values back.
Can I call DAQmxCreateTask() and DAQmxCreateAIVoltageChan() during intialization then repeatedly call DAQmxReadAnalogScalarF64() each time I need to read the ADC values?
Thanks
Tony
Solved! Go to Solution.
08-28-2009 09:50 AM
Tony,
From reading the description of the DAQmx functions you are calling the most efficient way for you to read your data would be to call CreateTask, CreateChannel and then Call DAQmxStartTask outside of your loop. Inside the loop all you need to call is DAQmx read. By adding the Start Task call outside of your loop, you ensure that DAQmx's internal state machine doesn't need to transition through additional states when you call read.
Hope this helps,
Dan