Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Scanning Analog channels - bare bones

Solved!
Go to solution

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

 

 

 

0 Kudos
Message 1 of 2
(3,007 Views)
Solution
Accepted by topic author Software_Monkey

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

Message 2 of 2
(3,004 Views)