Specs: NI-DAQmx 7, VisualStudio C++ 6.0, PCI-6722,8channel AO
We have a very simple application: set a voltage (actually 6 channels) and keep it 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.
In this forum post
http://forums.ni.com/ni/board/message?board.id=231&message.id=3283&query.id=18094 you talk about an AOOnePoint example, but I get an error that the NI-DAQ driver does not support my device.
I may need to use NI-DAQmx, but how? I would like to use something like AO_VWrite(,,), maybe for 6 channels in one call. But I can't find it in NI-DAQmx. It seems I need to setup buffers and frequencies. I have a working sample, but it seems a slow and certainly overkill of this simple application:
// Link with \DAQmx ANSI C Dev\lib\msvc\NIDAQmx.lib
#include "NIDAQmx.h"
double[2] data;
int taskHandleAnalog;
int written;
void Init()
{
DAQmxErrChk (DAQmxCreateTask("",&taskHandleAnalog));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandleAnalog,"Device and Channel Info","",0,10,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleAnalog,"",1000,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));
}
void SetVoltage( double voltage )
{
data[0] = voltage;
data[1] = voltage;
DAQmxStopTask(taskHandleAnalog);
DAQmxErrChk (DAQmxWriteAnalogF64(taskHandleAnalog,NUMBER_OF_AO_SAAMPLES,true,10.0,DAQmx_Val_GroupByChannel,data,&written,NULL));
}