From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Help getting DAQ analog output to reset to zero after the stop button is pressed?

 
Ive searched high and low and cant find an example, and im fairly new to labview
I am using the DAQmx sub-vi's
 
I am trying to output  -10 to 10 vdc.  my vi initially sets the slide control to zero prior to the while loop. then i can scale the voltage with the slide.  Overall, when the stop button is pressed, i would like the voltage to set to zero.
I attempted to do this with a property node on the output side of the loop, it sets the slide to zero; however, the voltage exist on my scope.
 
Nothing is connected to the scope while observing the vi function.
Also, if there are any recomendations for a better configuration, I appreciate the input.
 
 
equipment:
PCI-6014
Thanks,
Wayne
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0 Kudos
Message 1 of 11
(8,566 Views)

Have you tried putting another DAQmx write outside the loop and before the Clear task with a 0 constant wired to it? Just a guess, i have no practical DAQmx experience. I do not think the method with the 0 and Property not will work with regards to data flow programming. Also, have you updated to latest version of DAQ?

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 2 of 11
(8,566 Views)

Very clever idea! It worked.  In answer to your first question, no i had not tried the DaqMx write vi. to set output to zero.  We updated to the most recent software recently.

I deleted the property node for the slide control on the output side of the loop.  Then I placed the DAQmx write on the outside of the loop.  After running the VI, the voltage dropped to zero, and the slide stayed at its last setting. Im still learning so i assume its redundant to have the slide set to zero after the execution of the vi; the slide is set to zero on the startup.

i added the file for you to see.

Thanks much,

Wayne

 

0 Kudos
Message 3 of 11
(8,554 Views)

Sorry, here is the VI.

Wayne

 

Message 4 of 11
(8,554 Views)
Wayne,

Glad to hear you got it working. AnalogKid2DigitalMan is correct. Dataflow programming does not behave quite like you expect. Try thinking of it as a schematic, almost. If two VIs are not wired directly together, then there is no way for them to communicate (with the exception of property nodes, global variables, and other things that break dataflow programming). In your original VI, The property node did set the slider to 0, but this was only after the loop was done executing. Since the loop was no longer executing, the value of the slider was not being passed to the DAQmx write, and new values were not being sent to the DAQ board.

Hope this helps,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 5 of 11
(8,533 Views)

When I realized the logic of taking the DAQmx write loop value to zero by adding the additional DAQmx write on the outside of the function, several loose ends tied themselves together. 

I have completed the analog section, and am now reached a greater challange of doing the encoder input and data manipulation section. (i did find some good examples for this challenge).

I do have another question...

Where can I find information regarding the different DAQmx vi's?  The help section provides help in a conceptual way, but programmatically I cant resolve the exact role some of the vi's perform.  Example would be the stop task vi and the clear task vi.  I dont know the background information of what the function of those vi's are.

Thanks,

Wayne 

0 Kudos
Message 6 of 11
(8,526 Views)
Wayne,

The best way to get a feel for the various DAQmx VIs is to browse through the examples. We also offer customer education classes that go a bit deeper into the DAQmx state machine. More information on that can be found here:

http://www.ni.com/training/#-

To answer your specific question, the DAQmx Stop Task VI transitions the task from the Running to the Committed state. For continuous analog input, for instance, this would stop the DAQ card from acquiring more data. The task could then be restarted. If you were to execute a DAQmx Clear Task instead, this would also stop the acquisition, but also delete the task from memory and unreserve resources on the DAQ device.

Hope this helps,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 7 of 11
(8,509 Views)

I have a similar issue, I'd like to write 0 to my voltage output module vi DAQmx Write.vi but i'd like to do it as an 'emergency stop' function. So if someone clicks my stop boolean at any point during the operation of the VI it will overwrite the current running WriteVI (in a loop) and change voltage output to 0. Is this possible? I am getting resource issues at the moment. Presumably because it can't run two at the same time. I have tried using a Stop Task before trying to write to it but still errors (2000022)

 

Thanks

0 Kudos
Message 8 of 11
(5,319 Views)

Are you trying to implement the emergency stop using a different task? If so, that explains the error 200002. You can indeed have only one analog output task running at a time. You need to implement the functionality in the same task.

 

The same principle from the thread should apply. Say you have a while loop that can be stopped with a "normal" stop button and your emergency stop button. Either button would stop the generation, but then, you can have a case structure right after the while loop receiving the value from the emergency stop button; if it is true, it writes an output of 0 and if it is false, it just passes the reference.

 

In cases like this it is useful to post the code so other users can get a better idea of what you are trying. Can you do that?

 

Regards,

Camilo V.
National Instruments
0 Kudos
Message 9 of 11
(5,310 Views)

Thank you I have made it work by routing the task in to the emergency stop from the start task of my loop.

0 Kudos
Message 10 of 11
(5,305 Views)