Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

Continous Analog Out w/o Buffer-Need Example

I'm using a USB6009 with the NIAQmx C interface.
At times I need to generate a 1.0 volt or 0.0 volt output (1 datapoint) on AO0 and just hold it there, until I tell it to change values.  I don't want to cycle in a loop feeding a buffer if possible.  Can someone point me to an example of how to do this?
Don Hess
0 Kudos
Message 1 of 5

This code executes without error.  However when I go to measure ao0 on the USB6009 it still reads 0 volts.  All I want to do is lower or raise the output and hold it there on demand.  iWritten returns 1.

float64 f64Min

= 0.0; //0.0 min volts output

float64 f64Max

= 1.1; //1.1 max volts output

float64 fVal

= 1.0; //1.0 volts. What I want output to be

int32 iWritten

= 0;


(DAQmxCreateTask("AO", &m_hNIAOTask));




(DAQmxWriteAnalogF64(m_hNIAOTask, 1, TRUE, 10.0, DAQmx_Val_GroupByScanNumber, &fVal, &iWritten, NULL));


0 Kudos
Message 2 of 5

Hi dthess,

Your code looks good except you never call the DAQmxStartTask function to start the output. This is probably why the output never leaves 0 volts. Once you start the task the output will hold to whatever value you set and not change unless you call the write function again. One thing to remember is that the output will hold the last value written to it even after you stop the task. So if you want the output to be zero volts after your program finishes make sure to write 0 volts to the output before stopping the task. I good example of static timed AO is the example program VoltUpdate. This can be found with the DAQmx ANSI C examples under “C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog Out\Generate Voltage\Volt Update”. Please let me know if you have any questions.


NI Chief Hardware Engineer
0 Kudos
Message 3 of 5
Just FYI, if you need to write just one single value, you can use the scalar version of the write function:

Hope this helps.
Message 4 of 5

Thanks for the feedback guys.  As always it's appreciated.

I found the problem.  I was measureing the voltage on non clamped down screw terminals on the block.  Apparently the circuit does not carry here.  Once I inserted my probe into the clamp port, I saw the voltage swing.

Again thanks,



0 Kudos
Message 5 of 5