Showing results for 
Search instead for 
Did you mean: 

NI-DAQ changing values during runtime

Go to solution

Hello, I'm working on a project that involves changing the values of the voltage during runtime. Right now I'm using a NI USB-6356. The problem I'm running into is that when I change the voltage, the task immediately ends and the code only produces a wave for a fraction of a second. I need the code to be able to change the voltage and then have the task not end until I press a stop button. Attached is my VI. Thanks so much in advance!

0 Kudos
Message 1 of 2
Accepted by topic author RazorF

You appear to be using one of the Examples that ships with LabVIEW.  When you want to "start" from one of the NI-supplied Examples, you should first save it in your personal LabVIEW Data folder, preferably with a different name (which you seem to have done) to prevent "overwriting" the original.


You appear to have taken the Example Code and enclosed it inside an Event Structure.  To get the Code to run at all, you need to set the Voltage.  You do this with a Slider, which (unless you are extremely fast) will potentially generate numerous Value Change Events.  That's your first Big Mistake.  The second is that the only thing that allows the Voltage Event to end is an Error in the "DAQms Is Task Done?" function or an Error on the Error Line, neither of which will stop the Program.


Think about what this Example (as distributed by NI) does -- it gets one set of input parameters from the User, generates that one Waveform and goes until you push the Stop button (or Task Done is true).  This example uses a fixed Waveform that is generated once and used over and over in a "continuous" fashion.


You want to do something much more challenging -- changing the Waveform "on the fly".  An example that is closer to what you want is the "Voltage (non-regeneration)" example, but I suspect this might be above your level of expertise in basic LabVIEW.


Bob Schor

Message 2 of 2