LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3 colors (states) for an indicator (LED?)

If you are expecting your main VI to update while a subVI is running, it's not supposed to. Think about it for a second. When you call a subVI (or function in a text based language), you pass execution to that subVI which pauses the main. When the subVI finishes, it sets the return values and control passes back to the main. The main then gets the return values and can update it's indicators. Now, if you want your main to continue running and have an indicator change with a change of a control/indicator in a subVI, then you can do that with a little extra work. You can pass a reference of a main's indicator to the subVI and have the subVI write to the reference's value property. You can start up you subVI in a separate while loop from your main. You can use the Invoke Node's VI method to run a VI. There is a Get Control Value method that can then get the state of a subVI's indicator that you can use to update soemthing in your main.
0 Kudos
Message 11 of 22
(1,959 Views)
here is an example of my problem.  You have the Main VI, 'Simulation,' which is driving 'Impedance'.  As you flip 'Q' true and false (when impedance button is off), the LED should go from green to red to green to red.  As soon as the impedance button goes high, the LED should go blue regardless of the state of 'Q'.  If you have the 'Impedance' subvi open while you are running 'Simulation', You can see the light is working perfectly, but is not passing its state out of the subvi...  Smiley Sad
0 Kudos
Message 12 of 22
(1,957 Views)
wow Dennis, that sounds way more complicated than anything I usually do.  I normally can just update an LED or a control (whatever) in the subvi, and pass its properties into the main VI.  May take me some time to get through your message.
 
In my case, I do not expect the main VI to update, until the subvi is finished (i.e. until it is finished with its iteration)

Message Edited by Adma on 07-25-2006 09:03 AM

0 Kudos
Message 13 of 22
(1,956 Views)
Actually, I can't see anything. Can you save this as 7.1?
0 Kudos
Message 14 of 22
(1,953 Views)
tell me if this works?
0 Kudos
Message 15 of 22
(1,950 Views)
Now I see what you are trying to do. The subVI is not changing the state of an LED. It is changing the colors of an LED and it is changing the colors of an LED in the subVI and not in the main. All you are doing is passing the state back to the main. What you want to do is pass a reference to the main's LED to the subVI and update that reference in the subVI. Here's a fix. You could also have just passed back the cluster array and written to a property node in the main. That would work just as well as passing a reference but I thought you might want to see how you could use control references.

Message Edited by Dennis Knutson on 07-25-2006 08:32 AM

Message 16 of 22
(1,945 Views)
Dennis, thank you very much for your time...I really appreciate it!  Would you reccomend passing the cluster instead...in this cleaner?
0 Kudos
Message 17 of 22
(1,937 Views)
In this case, I'd have to say passing the cluster is a bit cleaner and probably more obvious to someone reading the program. Passing references would be preferred if you want to update a lot of properties (such as a graph's) and want to keep the size of the block diagram small. Or, as I mentioned earlier, if you want to update the state of an indicator while a subVI is running.
0 Kudos
Message 18 of 22
(1,933 Views)
Ok, i hope this is the last time I bug you...How did you change the reference to (strict) bool.  Everytime I try to run my VI, that I try to replicate off of yours I get the error, "LabVIEW:  Object reference is invalid."  and I know it has to do with my reference.  Thanks so much, again
0 Kudos
Message 19 of 22
(1,929 Views)
What I do is first click on the indicator and select 'Create Reference'. Then I right click on the reference and select 'Create Control'. I then go to the front panel, select the control reference, hit CTL+X and then paste it on the subVI's front panel. If you've already dropped a control reference onto a subVI from the refnum palette, then after selecting the correct class, you can right click and select 'Include Data Type'.
Message 20 of 22
(1,919 Views)