LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing control properties from statechart actions

Hi, my question is about application design using the statechart module.

 

I am using the statechart module to develop an application which acquires data from a CCD camera. Without going into the details, there is a front panel GUI with a variety of controls and indicators.

 

What is the best way to access the properties of the controls and indicators from the statechart actions?

 

Currently I am passing references to all the front panel controls in the input data of the statechart. This works fine, but I have an enormous cluster of references which seems like a rather untidy way of doing things. Also, each time I need to add a new reference, I have to make changes in 3 or 4 places in my code; for example, the front panel wiring diagram, the statechart input control, and any subVIs called from statechart actions.

 

In the event strucure that sends the triggers to the staterchart, various information is available, e.g. the value of the control which triggered the event. But there is no way of passing this to the statechart.

 

Is there a more elegant way of doing things?

 

Thanks,

 

Alex

 

The views expressed in this site are those of the originator and do not necessarily represent the views of NPL Management Ltd. Nothing in this post shall bind NPL Management Ltd in any contract or obligation.

The views expressed in this site are those of the originator and do not necessarily represent the views of NPL Management Ltd. Nothing in this post shall bind NPL Management Ltd in any contract or obligation.
0 Kudos
Message 1 of 5
(2,812 Views)

It sounds to me like you want to make a type def of the cluster, so one update will update all instances. You can change it to a type def by right clicking on the constant, selecting advanced -> customise. In the window that opens, change the drop down menu value from control to typedef.

 

Secondly, the best way to read and write to controls and indicators would be to read them before going into the case structure, and write to them after the case structure, This way you can also make more efficient use of shift registers.

_____________________________
- Cheers, Ed
0 Kudos
Message 2 of 5
(2,801 Views)

Hi BioMetrology,

 

Most of what it sounds like you are doing is about as good a methodology as I can think of. The fact that you have to update any subVIs called from actions makes it sound like you are not using typedefs on those subVI inputs/outputs, so I would recommend (as yenknip did) that you use typedefs there.

 

Other than that, if you want the information that is available from the event structure (value of control, etc), you will have to pass that in manually to the statechart somehow. Passing it as an input is the most natural way.

 

If having to pass in a huge cluster of references to the statechart is bothersome, you can always use other methods of communication to tell the statechart about all of the controls involved (eg, LV2 style globals, regular globals, LV queues), but just passing them in as inputs is a pretty natural thing to do as well. 

0 Kudos
Message 3 of 5
(2,791 Views)

aggieNick02 wrote:

If having to pass in a huge cluster of references to the statechart is bothersome, you can always use other methods of communication to tell the statechart about all of the controls involved (eg, LV2 style globals, regular globals, LV queues), but just passing them in as inputs is a pretty natural thing to do as well. 


 

Directly passing them as inputs is also the most efficient use of memory, as there is a minimal amoutn of data copying. I would reccommend keeping the cluster as an input, espescially as you say you have a large number of values in the cluster.

_____________________________
- Cheers, Ed
0 Kudos
Message 4 of 5
(2,784 Views)

Thanks everyone for all your suggestions.

 

I'll let you know how I get on!

 

Alex

The views expressed in this site are those of the originator and do not necessarily represent the views of NPL Management Ltd. Nothing in this post shall bind NPL Management Ltd in any contract or obligation.
0 Kudos
Message 5 of 5
(2,761 Views)