LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Subroutine inside a StateMachine ?

While coding StateMachines I often find a need to execute a particular set of states more often. And the easy way to do this is to just dplicate the required states to fall in line.

I  was wondering if this can be done like a Sub-routine call in a text based language : The enclosed VI ( broken though ) shows my requirement.

- I have main states from "Intialize"  to "EndState".  And  "subroutine"  states  from "Sub_A_Start"  to  "Sub_A_End".
 
- From State_02,  I want to jump to Sub_A_Start. Before I jump there, I also save the return point ( State_03) in a functional Global. 

- From the last state Sub_A_End, I would like to come back to State_03 and continue  the main. For this if I use the functional global and wire it to the StateCase SR, the  enumeration  of the SM is lost and  replaced by simple numbers.

While I can understand why this happens, I would like to know if there is way to pass enumeration data via  Functional Globals ?

Thanks

Raghunathan
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 1 of 4
(2,859 Views)


@Raghunathan wrote:


While I can understand why this happens, I would like to know if there is way to pass enumeration data via  Functional Globals ?



Make it a Type Def and use it everywhere that you refer to the states.

André
Regards,
André (CLA, CLED)
0 Kudos
Message 2 of 4
(2,846 Views)


andre.buurman@carya wrote:

Make  it a Type Def and use it everywhere that you refer to the states.


The State Cases are already contained in a Type Def enumeration.

But what I want to do is pass this Enumeration data type through a functional Global !

Is THAT possible ?

thanks

Raghunathan
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 3 of 4
(2,807 Views)


andre.buurman@carya wrote:

Make  it a Type Def and use it everywhere that you refer to the states.


Is THAT possible ?

Yes It is possible Smiley Very Happy The code as I wanted is attached.

thanks for your help.

Raghunathan



Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 4 of 4
(2,799 Views)