From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Gettting data into nested loop

Solved!
Go to solution

I have one loop which handles I/O including analog inputs.

I have a second loop which contains a state machine.  There are some 26 Cases and the process moves from state to state based on time AND analog input values.

I have used a notifier to send the analog input array to the second loop.

Unfortunately, each Case of the state machine has its own inner loop. The analog input values that I reference via local variables only update once the inner loop stops, consequently the analog input condition for proceeding to another step never occurs.  This is a serious problem that is holding up the whole project.

 

Attached is the top level code

0 Kudos
Message 1 of 4
(1,256 Views)
Solution
Accepted by topic author wildcatherder

Don't put while loops inside the cases.  You said you have a state machine.  Instead of looping within a state, just set it up so that it returns to the same state.  Each state should have a decision point as to whether it moves on to the next state, or returns to the same state such as when a given amount of time has not yet elapsed.

0 Kudos
Message 2 of 4
(1,241 Views)

The state machine was originally generated using the JKI State Machine Toolkit (which has its own problems).  Could you look at the example screen capture and tell me what I can safely remove?  I'm not sure I can just strip out the innermost loops and make it work.

0 Kudos
Message 3 of 4
(1,229 Views)

Thank you.  I was able to figure it out with your hint.  I have no idea why that innermost loop was put in there but I have changed five of the thirty cases of my State Machine already and it's going to work.

 

They probably wouldn't have fired me but this is going to make me a hero.

0 Kudos
Message 4 of 4
(1,211 Views)