LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

enum question

I have got a problem where I have a case structure with 5 cases called ControlON, ControlOFF, Start, Stop and Reset. Within these case's there are VISA write vi's to control an instrument.
 
I have created an 'enum' constant with all the relevant cases in it. What I would like to do is have a boolean switch for each of the cases so that when the user chooses one of the operations using one of the switch's,  then the corresponding case will run.
 
Can antone suggest anything?
0 Kudos
Message 1 of 6
(3,515 Views)
Ok, forget about the case structure + enum, and use an Event Structure inside a while loop. You can set up the event struct, to execute a bit of code (part you put in your different cases) only when an event occurs - for you, the events will be a "value change" on your buttons.

Hope this helps 😉


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 6
(3,510 Views)
Here is a very quick example to illustrate what I described in the previous post.

😉


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 3 of 6
(3,506 Views)
A little trick with enums and case structures for state machines, make the enum a typedef, this way you can add states to the enum in one place and have it change throughout the entire code.
 
paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 4 of 6
(3,502 Views)
One way to get around this is to wire each of the boolean switches to a Build Array (or something similar), wire the resulting boolean array to a Boolean Array to Number, and wire that in turn to the case structure.

Image and video hosting by TinyPic
0 Kudos
Message 5 of 6
(3,493 Views)

I am a little late on this one but I did not see a direct answer to the question (as I read it).

Use a Boolean >>> radio Button control.

Add as many buttons as you have states.

Done!

See below.

 

Ben

Message Edited by Ben on 09-06-2006 07:44 AM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 6
(3,428 Views)