LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

help with Cont Gen Voltage Wfm-Int Clk example

I would like to use this example vi as a subVI for my labview program.  It works great as an output to control my hardware.  The problem is that whenever it runs, the infinite loop within the example will cause my program to stay at this subvi and never progress to the later portions of my vi.  I need the signal from this subvi to continously output to my hardware, but also continue processing the other portions of my main vi.  I would also like to use the signal generated as a wire to trigger segments of my main program.  Is there a way to change this example to do these two things?
 
Thanks,
Anthony
0 Kudos
Message 1 of 7
(3,621 Views)
You could modify it to stop when the task is complete.   Right click on the logical OR, select "Replace", select "Boolean Palette", select the "Compound Arithmatic".  You can then stretch the Compound Arithmatic up to add another terminal.  Wire in the boolean output of the DAQmx Is Task Done.

On the other hand, I think that the while loop is unecessary for your sub-vi. 
0 Kudos
Message 2 of 7
(3,615 Views)

Anthony,

If you want to use this example program as a subVI, the while loop will keep your main VI from executing.   To solve this, you could simply place the subVI in a while loop that is in parallel with the rest of your code.  This will allow the subVI and mainVI to continue executing.  Alternatively, you could write the DAQ voltage generation code into your application or use the DAQ Assistant.

Jesse O.
Application Engineering
National Instruments

Jesse O. | National Instruments R&D
0 Kudos
Message 3 of 7
(3,602 Views)
I was attempting your suggestion with running the subvi simultaneously with the rest of my code, but the voltage wafeforms subvi is still not executing.  Could you check our vi to see if it is setup properly for simultaneous execution?  I placed the subvi into another while loop as suggested.  I made some minor modifications to the example vi, but the changes should not have impacted anything to affect the external code.  I have attached the main and sub vis.
0 Kudos
Message 4 of 7
(3,594 Views)

Anthony,

The reason why your two loops aren’t executing at the same time is that you have created a data dependency between the two loops with the stop being wired from one loop to the other. This means that the second loop (the one with your example call) will not begin till it receives the stop command from the first loop. To avoid this dependency by yet still have one stop button command control both loops, use a local variable (of you stop control) to control the stop of the second loop. This way you will remove the data dependency will having one stop button control both cases.

There is an example shipped with LabVIEW that shows how to do this. You can find it in the Example Finder (Help Menu >> Find Examples) in the following folder structure:

Fundamentals >> Local and Global Variables >> “Stopping Parallel While Loops without Reset.vi”

Hope that clears things up for you, let us know if you have any other questions.

 

-GDE

Message 5 of 7
(3,580 Views)
The voltage generation now works properly as a subvi using simultaneous execution, but I would also like it to have the 3 waveforms as output terminals so they can be wired out into my main VI for further processing.  I tried using the connector to the waveform graph of the cont gen voltage subvi and displaying that in my main vi as a graph indicator, but nothing shows up when run.  Is there a way to use this signal without routing the output signal back into an analog channel and reacquiring the signal?
0 Kudos
Message 6 of 7
(3,550 Views)

Anthony,

Sounds like you trying to set the Waveform Graph displays that are on the front panel as your output terminals. That is not going to work for what you really want. All that you are going to get by doing that, is the last set of data that was retrieved in the last iteration of the while loop. Rather then all of the data from each iteration which is what I assume you want. There are a couple of things you can do to transfer this information to your main VI. There are two routes that I see initially that you can go.

One you could log all of the data to a file, and then in your main VI open that file and read in all of that data. That would be great if you wanted to log the raw data any way.

The second method you could go with is to build a big array or waveform of all of the data (data from each iteration), and pass this complete array or waveform out of your while loop and then from there you can pass it out via an output terminal. Just make sure that you have the entire waveform that you want to pass out, in some form outside the while loop. Then you will be able to pass it from subVI to mainVI without any problem.

Hope that helps, good luck.

 

-GDE

0 Kudos
Message 7 of 7
(3,537 Views)