LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger Event Structure in SubVI

Here's my goal.  I have a VI that sets two analog outputs which in turn control a power supply.  One output controls voltage while the other controls Current Limit.  I created a VI which uses an event structure so that when the voltage or current limit is changed, the analog outputs are adjusted accordingly. 
 
Now, I'd like to turn that into a SubVI and have it running in the background while my main VI runs.  I'd like to be able to go into the subVI and change those values at certain locations within the main VI.  I tried just using the subVI with register events, but it hangs because it is waiting for the subVI to finish before continuing.  I tried using the Run VI methond with "wait until done" set to false, but then I don't see how to trigger my events because I can't link my mainVI to the events that need to be triggered.  I can set the control using Control Value Set, but that doesn't do anything for my event structure and thus stuck again. 
 
Maybe the event structure isn't the best way to do what I'm seeking.  But I don't want to set all this up in my Main VI because it just adds too much complications and I already have the VI working by itself and just want to turn it into a subVI.
 
Thanks.
Message 1 of 5
(9,697 Views)

Value (sgnl) will trigger an event structure just like a user event

 

http://forums.ni.com/ni/board/message?board.id=170&message.id=298221#M298221

0 Kudos
Message 2 of 5
(9,682 Views)

Yes, but I don't think that solves my problem.  If I just use the subVI normally, it hangs until done.  If I use run VI method, how do I link to something that can trigger the event.  I don't think I can link to the val(Sgnl) property node can I?

It would be easiest if I could just run the subVI and have it not wait until done, but do that without using the Run VI Method.  Is there a way to set the subVI to run such that the main VI doesn't wait for it to be done before moving on (without using Run VI Method)?

0 Kudos
Message 3 of 5
(9,673 Views)
You could either get a reference to the SubVI and find the specific control like the attached picture, or you could pull the SubVI out of the main loop.  If the SubVI is necessary for data flow, you are almost certainly going to have a hang up if you don't call it by reference.
 
 
 
 
edit - Another, probably less popular, option would be to have the subvi running in a parallel loop and have locals take data from the control loop and write to the command loop.  You'd have to be careful to only have one local writer, though.


Message Edited by JeffOverton on 01-30-2008 02:39 PM
0 Kudos
Message 4 of 5
(9,670 Views)
Thanks much!  That's what I was looking for.
0 Kudos
Message 5 of 5
(9,657 Views)