Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

how to generate sustained output signal?

I have a NI PCI-6703, which generates output voltages on 16 channels (Dev1/ao0:15).

I'm trying to write C++ code (PyDAQmx code, actually) to set each channel to a different voltage and have each channel sustain that output voltage until I send another command to change the voltage. Can anyone point me to an example or the commands to do that?

 

I have read through a fair bit of NI documentation, set up task handles, and read through the NI example code in National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog Out\Generate Voltage\Volt Update\VoltUpdate.c. I see there that calling DAQmxWriteAnalogF64 seems to be one way to set the output voltage for a channel. However that code seems to set the voltage for 1 sample, which seems to mean for one clock cycle. I want to set the voltage instead to a certain voltage on each channel, and have it stay there indefinitely until I call a set-voltage-command again to change it to another voltage.


Apologies if this is too simple of a question; I have read a lot of NI documentation, but the examplees and documentation seem mostly aimed at acquiring samples rather than generating voltages.

 

Thanks for any help with this.

 

Best,

 Bobby O

0 Kudos
Message 1 of 5
(4,313 Views)

Actually, when you write a voltage to an output, that voltage will sustain until you write a new voltage value. Hence, DAQmxWriteAnalogF64 is a way to go.

Message 2 of 5
(4,302 Views)

Thanks! I'm new to using this API call; could give an example of setting channel "Dev1/Ao0" to +10.0 volts using DAQmxWriteAnalogF64, e.g. how to set the fields described in the API to set and sustain the +10.0 voltage on a channel using:

 

int32 DAQmxWriteAnalogF64 (TaskHandle taskHandle, int32 numSampsPerChan, bool32 autoStart, float64 timeout, bool32 dataLayout, float64 writeArray[], int32 *sampsPerChanWritten, bool32 *reserved)

 

Best,

  Bobby O

 

 

0 Kudos
Message 3 of 5
(4,272 Views)

E.g.  I have 16 channels (Dev1/ao0:15), how do I control which channel is getting the voltage setting?

I'm also unsure of the impact of numSampsPerChan, autoStart, timeout, .... Hopefully a concrete example of setting the voltage to hold at a value for one of my channels will make that concrete. (Then I can call that command separately for each channel when voltage changes are needed).

0 Kudos
Message 4 of 5
(4,271 Views)

Hi there,

 

I've found a couple resources that might be helpful for you.  Here is the info sheet for the function:

http://zone.ni.com/reference/en-XX/help/370471Y-01/daqmxcfunc/daqmxwriteanalogf64/

 

Also, here is some example code from another forum post where the person was doing something similar:

http://forums.ni.com/t5/Measurement-Studio-for-VC/Updating-single-value-voltage-output-in-loop/m-p/9...

 

Does this help answer your question?

Julian R.
Applications Engineer
National Instruments
0 Kudos
Message 5 of 5
(4,238 Views)