Showing results for 
Search instead for 
Did you mean: 

Turn voltage on DAQmx to value, hold at said value, turn off, wait, repeat

I would like to set up a program that will allow me to send various voltages using ao0 (step function perhaps) that will send voltage 1, v1 for some time, t1, then turn off for some wait time, w1. then be able to add multiple levels (i.e. v2, t2, w2, etc etc) then have a simple waveform that can read this (ai0) and graph continuously as voltages change. 


using labview 2012 and ni usb x series DAQ


any ideas would be very helpful!



0 Kudos
Message 1 of 5

Start with the DAQmx examples. In LabVIEW, under help, go to Find Examples. In the example finder that opens, look under Hardware Input and Output, and the DAQmx category within that. There are examples for analog input and output.

0 Kudos
Message 2 of 5

I have done this, but I am unable to figure out how to step at various levels with user input...all of them want to use preprogrammed functions

0 Kudos
Message 3 of 5

You probably just need to put your set-wait-clear-wait into a FOR loop.  Put your desired values in an array and use autoindexing to control the output.  Setup the DAQmx task before this loop and close it down after the loop.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 4 of 5

Assuming you know what the waveform is supposed to look like before you actually start generating anything, you'll want to build it up into an array (perhaps using a method like crossrulz suggested).  Your DAQ code would look something like this, but rather than writing an array of waveforms, change the instance of DAQmx Write to accept a single array of DBL values.  Each element in the array is a single voltage that will be clocked out by the DAQ card at whatever rate you select (e.g. 1 kHz sample rate, each element of the array would be 1 ms of data).


Once you get the output working (maybe verify by running an analog input test panel or something to keep everything simple) add in your analog input task.  It will look something like this, configure the AO Start trigger as the digital start trigger for your analog input task.  Start the analog input task before the analog output task.  Make sure the duration of the analog input task matches your total generation time.  You could even run the two examples separately before merging them into a single VI.



Best Regards,

John Passiak
0 Kudos
Message 5 of 5