Showing results for 
Search instead for 
Did you mean: 

Cycle Enum with case structure using a nutton

Fairly new in programming with labview.

The goal is to cycle enum which is input to the case structure. 

The button would change from one case to other while the code is running by changing the input enum.

Attached is the code without a case structure. 

Any suggestion of implementing this with case structure would be helpful .

0 Kudos
Message 1 of 5

You can replace the select node with a case structure with the FALSE case wired across and the TRUE case containing the +1. No change in functionality.


Maybe I don't understand the question....

0 Kudos
Message 2 of 5

Here Is the code that I am working on.

I plan to to use "Next Case" button to switch enums from Alpha to Beta and so on and then back to alpha. 

0 Kudos
Message 3 of 5

Well, think dataflow! Your code is trapped inside inner loops most of the time and the outer loop can only iterate (and read the button at the next iteration!) when everything in the current iteration has completed, which is unlikely to happen unless there is a magical combination of several coincidences.


There are a lot of serious architectural problems (unnecessary use of local variable, no event for the stop button, event structure inside inner structures, silly operations with boolean constants, etc. etc.). Go back and design a proper state machine. This needs to be re-architected from scratch.

Message 4 of 5

I was planning to update the architecture once I understand if it's possible to have buttons for individual cases and how they would work. Or if I can have a button that would increment the enum to switch from case 1 to case 2. As I said fairly new to Labview so I started with a rough code.
would you suggest having a event structure for individual case and have a bolean button for each enum which I have right now for the case structure ? 

0 Kudos
Message 5 of 5