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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update analog out waveform without stopping program

Hi all,

I've been working on a LabVIEW program which outputs an arbitrary waveform on a USB6353 DAQ. The output is manually triggered with a counter, and should only be written to AO once. All is working well, except that whenever I change the waveform I'd like to output, I have to abort the program to get it to update. Otherwise, it will just output the first waveform (regeneration allowed) or output nothing (no regeneration allowed). My subVI is attached. I immensely appreciate any help.


PS: I realize the retriggerable property node is disabled. Changing it does not change my outcome, though.

0 Kudos
Message 1 of 6
(1,965 Views)

Hi Aeryck,

 

please don't use images in ancient BMP format, PNG is much smaller (29kB vs 1.2MB).

And you should inline the image instead of attaching:

Custom_DAQ_Output_protod.png

In general you should also attach the VI instead of a plain image!

 

What are you doing in those other states?

Do you stop your AO task somewhere and write a new waveform?

Do you create a new task each time state 2 is called? (I hope it's not the case…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,940 Views)

What you want is possible and should just require Writing a new output at the appropriate time.

 

You said you attached the VI, but actually you attached an image of a VI, so I can't see the other cases.

I'm suspicious about the use default if unwired tasks - it seems likely you're doing "something wrong" in the handling of tasks which is causing your problems.

 

Can you attach the actual VI or a snippet?


GCentral
0 Kudos
Message 3 of 6
(1,936 Views)

Apologies, I'll keep that in mind for future posts.

0 Kudos
Message 4 of 6
(1,935 Views)

Here's the VI. Thank you for the quick response!

0 Kudos
Message 5 of 6
(1,930 Views)

Hi Aeryck,

 

So there's a couple of things I think you might have missed about LabVIEW, based on your VI. A few changes might get you closer to what you're looking for. The points below are numbered to ease in referencing in a reply, not because of any particular order of importance:

  1. Array indices and loop counters (i) in LabVIEW start from 0. As a result, your first loop will go to the "4, Default" case (because there is no 0 case) and then stop. Is this intended?
  2. When you have a predetermined (i.e. before the start of, not necessary before clicking run) number of iterations for a loop (all of your loops can be made to fit this criteria) then you should use a For loop rather than a While loop. In your case, you have an array of "runs" (not sure what you'd call them) that you want to go through - this array can be auto-indexed by a For loop.
  3. If you want to start new tasks during execution of the VI (it sounds like you do from the first post) you should read about State Machines. You could use a SM to have different cases for each type of output, and then an idle case to return to when done, and check for a new choice.
  4. DAQmx has a "Wait until Done" VI that will probably be useful in that case, based on your tasks all being finite duration (not sure if that's true or not, but I think so).

 


GCentral
Message 6 of 6
(1,840 Views)