LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

no text in state machine with enumerated case list

The attached "Standard State Machine" template uses an enumerated list to select the cases in the Case structure. Notice that the name of the case appears in the case selection box. When I try to do the same thing I find that the numbers, not the names, of the enumerated list appear in the case selection box. It's difficult to klnow which-case-is-which-number when flipping through the case structure.

When using an enumerated list, what has to be done to get the names listed in the case selection box?
--
Chrs
0 Kudos
Message 1 of 11
(3,650 Views)

I would guess that you're using a ring instead of en enum.  There should be two little horizontal arrows on the inside-left of your constant



Message Edited by JeffOverton on 04-16-2008 09:00 AM
0 Kudos
Message 2 of 11
(3,640 Views)
Please ensure that you are using an enum. A ring would act like your description.
0 Kudos
Message 3 of 11
(3,636 Views)
Jeff and JB,

Thanks for the help. I was actually using enumerated type, but it turned out one case had no exit case defined! Live and learn.
--
L8r
0 Kudos
Message 4 of 11
(3,623 Views)

@Holubtsi wrote:
I was actually using enumerated type, but it turned out one case had no exit case defined! Live and learn.

That statement makes absolutely no sense on various levels. The case labels are driven by what's connected to the selector terminal. What does "one case had no exit case defined" even mean?
0 Kudos
Message 5 of 11
(3,604 Views)
smercurio_fc,

In the FSM, when the selected case exits it is supposed to have the next case selection wired to the right-hand shift register of the While loop. In the problem, not all the cases were wired to the While loop. This meant the case exit tunnel was not a solid blue square but rather it was a blue outine with a white centre. Interestingly, the exit tunnel also had a small red mark (glyph?) on it, probably indicating a type conflict or coercion. I guess the case structure was able to resolve the conflict once all the I/O was consistently enumerated type.

Does that make sense?
--
Chrs
0 Kudos
Message 6 of 11
(3,598 Views)
No, because even if you delete one of the wires going to the exit tunnel of the case structure, the datatype that's driving the case structure isn't changing. If you had a numeric constant wired as the initializer to the shift register, rather than the enum, then you'd get numerical values for the case labels, even if you were using enumerations inside the case structure.

For instance, take the state machine example provided here. Go to any case and delete the wire that's going to the exit tunnel. You will see that the case labels don't change. However, if you replace the "Init" constant on the left that's wired to the left shift register with a numeric constant, then all the case labels change to numbers, even though all the case structures have an enum wired to the exit tunnel.

What version of LabVIEW are you using?
0 Kudos
Message 7 of 11
(3,593 Views)
LabView 8.5
--

0 Kudos
Message 8 of 11
(3,589 Views)

Holubtsi:

The state machine template that you are using is not quite the best.  It looks for a "stop" enum to stop the loop.  What if you wanted to do some clean up when stopping?  Like turn off power supplies, etc.  The best way to do it is to create an stop case when the "stop" enum comes up.  Don't use the equal to "stop" function to stop the loop.  In the stop case, wire a True constant to the edge of the case structure and then to the loop stop sign.  The case edge terminal should be set to "Use default if unwired".  When the stop case is called, you can put code to clean up and gracefully shutdown instruments, and then the loop is stopped.  Also, from what I have seen from others (and myself), it is usually called "exit" or "quit" instead of stop.  Just a personal preference.

- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 11
(3,544 Views)
tbob,

Good input -- I'll be updating some FSMs. Thanks.

I wonder if there is a repository for these LabVIEW 'best practices' that is available for quick review (other than what is in the LabVIEW 'examples')?
--

0 Kudos
Message 10 of 11
(3,517 Views)