LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling front panel properties from within a statechart

I have a user interface that I am trying to put into a statechart.  On the user interface I have a bunch of buttons (controls) and indicators.  To populate the indicators I am getting data back from 2 sources (USB and RS 232).  For this, I have made shared variables for the data returning from the sources but this only works for indicators as far as I can see.  Anyway, I have the software working and now that I am trying to go back and place the code into the statechart format to clean it up I am running into issues.  Since the statechart does not run inside the labview panel I can not access the front panel properties of controls.  Basically, I am using the statechart to control which buttons are active on the front panel (this is dependent on the state the user is in).  Also I am using the states to control a LabVIEW “tab control” to determine which tab to display.  For instance, I have an operate screen and a calibrate screen.  Depending on which state the operator is in, different controls are active (I don’t want the user to accidently change an item on the operate screen while in calibrate).  Is there a way to do this inside the statechart structure?  

0 Kudos
Message 1 of 4
(2,328 Views)

You want to do this the same way you would do it if you had to do the manipulation of the front panel from within a subVI.

 

I would recommend reading about control references and pass references to the controls/indicators you want to manipulate into the statechart. That is probably what you are looking for.

0 Kudos
Message 2 of 4
(2,325 Views)

I am not sure if I am doing something wrong or if this will not work.  When I go to my main vi and create a reference to the control and copy this to the statechart diagram it recreates the  control on the statechart screen and then when I run the statechart the values on the front panel of the vi do not update.  I have also tried to make my front panel items global and this does not work either.  I am at a loss again as to how to control the front panel items with the statechart diagram toolbox.

 

 

0 Kudos
Message 3 of 4
(2,289 Views)

You don't actually copy the reference itself. Rather, you want to add a control of the same type as the reference to your statechart Inputs.ctl. You can get such a control by right clicking on the reference you created and choosing "create control".

 

Then you pass in the reference to your specific control into the statechart via the inputs terminal. You can then talk to this reference via VI server and manipulate the original control. 

 

If this isn't clear probably the best thing to do is to look in the LV help index for the keyword "control references" and read about "passing to subVIs". Passing a reference to a subVI is very much like passing one to a statechart so most of this is relevant.

 

Hope that helps.

0 Kudos
Message 4 of 4
(2,275 Views)