LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you force DAQmx output to 0 at the end of program execution?

I am using a 6713 to generate an arbitrary analog waveform on its output. However, once the labview vi has finished execution, the output voltage from the 6713 does not go back to 0 V. I have tried to force it back to 0 V by appending a 0 V amplitude waveform to the end of the analog waveform to mixed results (if I give it thousands of points, it goes to 0, but if I make it a more reasonable 100 points, it doesn't). How can I force the output back to 0 V. I tried stopping the task, clearing it, and stopping it and then clearing it. None of those worked.

Any help would be greatly appreciated.
0 Kudos
Message 1 of 14
(6,336 Views)
First, I have to ask, did you write this VI?
 
It is very hard to follow and has a lot of confusing structures in it.  IN the middle area where a lot of the DAQmx functions are, the error wire loops around so much it is hard to tell what is happening in what order.  To the lower left, an array is converted to a cluster, the cluster is unbundled, the individual elements are fed to a compound addition to get a single value.  Why not just use a sum array function on the original array?
 
The stop button is fed to the Stop Sign function.  This is Abort execution which is the same as hitting the red stop button at the top of the VI.  It ends the execution of the VI right then and there and doesn't allow anything else to happen.  Read the context help for that function.  As someone else has said on the forum,  "Using the Abort button is like using a tree to stop your car.  It will stop it, but there might be consequences."
 
How is this VI being run?  Is the Run Continuous button being used?  My guess is yes because I don't see any While loops and the only thing the stop button does is end the program abruptly.
 
You will need to rethink your whole architecture.  Stuff that needs to happen once should be set up before a while loop that has wires leading to the while loop or uses a flat sequence to make sure that it happens first.  This is you program initialization.
 
Everything that happens repeatedly would be in the while loop.  The front panel Stop button is what ends this loop.
 
Anything that has to happen before the program ends like closing out tasks happens after the while loop (either by wires for dataflow or in 3rd frame of a flat sequence structure.  With this, you should be able to reset your tasks so they output a zero voltage from the analog outputs before the tasks are closed and the program ends naturally.
 
Appending a zero to the end of the waveform won't help because if the waveforms run continuously, it will restart back at the beginning.
 
I would highly recommend looking at the example VI's for DAQmx functions and taking the tutorials for Labview that are available on the NI website.


Message Edited by Ravens Fan on 02-23-2008 10:45 PM
0 Kudos
Message 2 of 14
(6,321 Views)
Another thing.  You have a serious race condition in the lower right of your program.  You have 2 local variables 6713 Poration Signal Out and 6713 Poration Counter Out  (what is Poration?  is that a word?).  You read those local variables before there values ever get set by the indicators that are located above this code.  The error wire (although it wraps around alot) determines the order of execution.
0 Kudos
Message 3 of 14
(6,316 Views)

Hi DanJS,

It’s always a good idea to first start with something proven, get it to work, and then add more functionality.

As mentioned, LabVIEW ships with examples, found by choosing Help » Find Examples. You have to navigate the Example Finder, and the example “Cont Gen Voltage Wfm-Int Clk-On-Board Regeneration.vi” is a good one to start with. It is found under Hardware Input and Output » DAQmx » Analog Generation » Voltage.

Mark E.
Precision DC Product Support Engineer
National Instruments

0 Kudos
Message 4 of 14
(6,283 Views)

Hi all,

 

I'd like to get back to this thread because I have the exact same problem and I can't find any nice solution.

I use an analog output to generate a voltage. I use a continuous generation. I'd like that the voltage is send back to 0 at the end of the execution of the VI whereas it always retain the last value generated when I stop the generation.

Here is what I tried:

1. writting a 0 just before clearing the task.

2. writting as many 0s as necessary to fill the buffer and then clearing the task (VI attached).

3. resetting device at the end. This works but it's a little bit like repairing a watch with a hammer.

 

Any clue why solution 2 doesn't work ?

Thanks a lot !

____________________
JB
0 Kudos
Message 5 of 14
(5,796 Views)

You might have to stop the task, write the buffer, and restart it.  Then stop and clear the task for good.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 14
(5,793 Views)

Hi and thanks for the quick answer.

 

I tried what you propose, stopping the task, writing 0s in the buffer, starting the task again, stopping, clearing. No change, I still have a non-zero voltage at the end. I also try to 50ms after the start, to be sure the task writes in the buffer, no change.

 

Any other idea ?

____________________
JB
0 Kudos
Message 7 of 14
(5,784 Views)

I had a similar problem to this a while ago. I think it was because I was clearing the task before the D/A had chance to write the zeros.

I thought this would have been accounted for in your DAQmx Wait Until Done (VI). Reading the Help, it says it is normally used for finite generation and not continuous so maybe this is the problem?

 

I would try putting a nice big wait before clearing the task and remove the Wait Until Done VI.

 

Kind Regards

Lewis Gear CLA
LabVIEW UAV

0 Kudos
Message 8 of 14
(5,770 Views)

Here is what I do:

 

Capture d’écran 2012-11-15 à 11.19.59.png

Running this with animated execution tells me that the "Sart Task" VI hangs a little and produce error 200946.

Looking at the forums for this error, I found this thread.

 

So, it seems there is no simple solution to send the AO to 0 after the execution of a VI. In my opinion, the default behavior should be to send all the outputs to 0 when the tasks end, but it's only my opinion...

 

 

 

____________________
JB
0 Kudos
Message 9 of 14
(5,756 Views)

 

Ok, I solved my problem by writing zeros on my output starting a new generation.

It's not really satisfying, but it works.

 

Thanks for the help !

____________________
JB
0 Kudos
Message 10 of 14
(5,738 Views)