Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple single point analog output with NI-DAQmx in VC++ 6.0

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.
 
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 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));
0 Kudos
Message 1 of 2
(3,342 Views)
Sorry about this multi posting, I don't know how to delete it
0 Kudos
Message 2 of 2
(3,338 Views)