01-29-2009 07:13 AM
I would like to have a little more information about how data is getting passed with the StateCharts. I know that under LabVIEW pass by value or pass by reference is controlled by the compiler but I was wondering with the StateChart how inputs and outputs are passed.
The reason that I ask is because I have an application where I am receiving a lot of data from 2 loops and I would like to place this vi into the StateChart format. However, the true reason for the statechart is not the data acquisition part but the user interface to the data and various screens shown to the user. Since the data from the 2 loops is being used to display data to the user all data from the 2 loops needs to be passed back to the user interface loop for display.
While a little cumbersome to put the data in the inputs and output .ctl files, if the Inputs and Outputs are pass by reference (i.e. not copied over each time) I would think this would be a better solution than using a global variable or shared variable. Currently, to handle the data I am using the in place element structure such that the data is not being copied.
01-29-2009 07:43 AM
01-29-2009 08:12 AM
01-29-2009 09:00 AM
01-29-2009 10:36 AM
Data is passed in to/out of the statechart in the same way data is passed in to/out of a subVI (by value). You can place the type of data you want to provide to the statechart in the input/output control typedefs of the statechart. If your passing in/out and use of the data in the statechart is done right, no data copies will be made (as is the case with a subVI).
Alternatively, you can also use techniques like the single-element queue to get by-reference behavior if that is what you want.
Hope this helps.
- Nick
11-06-2013 03:38 PM
Nick does this mean that all data that is to be passed or altered between states in the stechart have to be included in these 2 controls' definitions? In other words if I have a 4 state chart and a single unique variable that is only used by states 2 and 3, I need to have it defined in these controls which serve as teh interface to the entire statechart.....
11-07-2013 12:27 PM
Hi id,
This thread is fairly old, if you post an issue to a new thread, you're more likely to get traffic.
Regards,