Specs: NI-DAQmx 7, VisualStudio C++ 6.0, PCI-6722,8channel AO
We have a very simple application: set a voltage (actually 6 different channels) and keep until we want it changed again, perform the change very quickly in response to an image capturing algorithm. So I don't need any waveforms or buffering.
I may need to use NI-DAQmx, but how? I have a working sample, but it seems a bit slow and certainly overkill of this simple application:
// Link with \DAQmx ANSI C Dev\lib\msvc\NIDAQmx.lib
#include "NIDAQmx.h"
void SetVoltage( double voltage )
{
DAQmxErrChk (DAQmxCreateTask("",&taskHandleAnalog));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandleAnalog,sChannel,"",m_MinVoltage,m_MaxVoltage,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleAnalog,"",Freq,DAQmx_Val_Rising,DAQmx_Val_ContSamps,NUMBER_OF_AO_SAAMPLES));
DAQmxErrChk (DAQmxWriteAnalogF64(taskHandleAnalog,NUMBER_OF_AO_SAAMPLES,0,1.0,DAQmx_Val_GroupByChannel,data,&written,NULL));
DAQmxErrChk (DAQmxStartTask(taskHandleAnalog));