LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Run in a particular sequence

Solved!
Go to solution

Thanks, i've more or less understood the state machine and i tried it to run another sequence.

 

However i have 2 issues:

 

1) I've made another vi (attached), whereby it displays a message for the user to choose the type of test. In the first initialize state, the user will select and base on the type of test input, it selects the next state to go to. If the type of test is default(empty string), it will display a message to ask the user to select again and click OK button. However i'm encountering an issue with it as it seems to be always 1 step behind. Even though the user has selected a type of test, it will still go to the default case. And only after pressing ok for the 2nd time, then it will run the correct case.

 

2) The next issue is(same attached VI), once it reaches the 2nd state which is where the user enters in the specimen parameters, it checks for any input less than or equal to zero. if all inputs are more than zero, then the next state goes thru successfully. However if any input is less than or equal to zero, the same state is run over and over again even though the input has been corrected.

 

Please see attached vi. 

 

thanks.

0 Kudos
Message 11 of 18
(1,007 Views)

1) just some correction: for issue 1, it also keeps repeating even though the combo box value has been change.

0 Kudos
Message 12 of 18
(1,000 Views)

For your 1st issue, you have a Display Message express vi outside the loop.  It will execute before the loop even starts.  Then you have a bunch of these throughout your vi.  This is not a good idea.  Also, the Type of Test is outside the loop.  Whatever type is chosen at the beginning of the program will remain because it is only read once.  This needs to be inside the loop as well.

 

Your init case should contain the Type of Test control, your OK button loop, and the case structure.  You don't need to display a message.  Just put instructions on the screen to select a test and press OK.  The Display Message causes the user to press OK to get rid of the message box, then the user has to press the OK button to start the test.  No need to press two OKs.  As an alternative, you could use the Prompt User for Input function instead.  It will allow you to list the tests inside the dialog box.  The user chooses the test and presses OK.  The output is an index number of the test chosen.  You would need to use a case structure to select the proper enum based on the index.  You could just change the case structure you have now to accept a number instead of a string.  After each test, make the next state the inti state to prompt the user again.  I think this would be the best way to go.

 

I'll look at your next problem in a minute.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 13 of 18
(998 Views)
Solution
Accepted by topic author BPBP

OK second problem.  First of all, the not equal to False code is lame.  The output of the last OR is either True or False. so why test it to see if it is false.  Looks like you just need to invert the boolean.  Use a NOT function instead.  Again, the numeric controls are outside the loop.  They get read only once, at the beginning of the program, and never again.  That is why any change is never seen.  Put the controls inside the loop so they get read every time the User Input case comes up.

- tbob

Inventor of the WORM Global
Message 14 of 18
(989 Views)

OK the state machine looks good for fundementals. Now with the example that I am providing we take that to the next level. I tried to add as much explination as I could to get you moving. Let me know if you have questions.

Tim
GHSP
Message 15 of 18
(983 Views)

thanks. I have em inside the loop now.

0 Kudos
Message 16 of 18
(971 Views)

I only been using LabVIEW for a few days and I have no prior programming experience so arrayed states and clustered controls, message passing FIFO in and out of structures is too deep for me at the moment.

 

However based on your VI, I made an event structure to wait for user to select the type of test. I think that works way better then loop/ok button. Thanks for taking time to introduce me. Thanks that has been of great help.

0 Kudos
Message 17 of 18
(964 Views)

If you ever want to learn how to use the tools that I gave you just let me know. It really is quite easy to use it just looks hard.

Tim
GHSP
0 Kudos
Message 18 of 18
(960 Views)