04-03-2013 10:53 AM
I am trying to figure out how to use the same button to perform a front panel activity function several times. I am writing a test program that at several times throughout the program needs to be paused. The user is then instructed to perform a certain function such as taking a measurement or connecting equipment. After following the current instruction they will click a resume button. This will be the only button on the front panel. I would be very grateful for any help. My program is almost done except for this last function that has been frustrating me for several days.
04-03-2013 10:59 AM
Hopefully you are using a state machine. Process the button by going to different states depending on the state you are at. Can you share your code so we can give a little better advice?
04-03-2013 11:06 AM - edited 04-03-2013 11:07 AM
on different parts of your program you can "enable,""disable," and "disable and grayed out" by writing to the boolean switch implicit properties by right click(bool switch) create property node .
04-03-2013 11:24 AM
Thanks for replying. I am not using a state machine, I will start looking into how to use one. I have attached my code, I am controlling a USB DAQ with it. Currently I am using time delays where I want to add the pauses between some of the loops. This is my first program in Labview so I'm sure it will seem a bit ugly.
04-03-2013 11:34 AM
Definitely should be a state machine.
In the meantime, you could get by withing using a dialog box that pops up with the instructions to the user and a button that tells them to hit OK to continue.
04-03-2013 11:41 AM - edited 04-03-2013 11:42 AM
apok,
That was what I was trying to do but I couldn't get it to work. Here is the code I made to play around with the pause function. I couldn't get the program to continue after I hit the first pause.
Thanks.
04-03-2013 11:53 AM
That little loop is going to start running immediately since it is in parallel to all other code. And when it stops it won't restart.
Look on the Dialog and User Interface palette for an express VI that says Display Message to User.
04-03-2013 12:04 PM
Yeah, you have a perfect canidate for a state machine. And you can likely turn a lot of that code into subVIs to make things even easier (look for code you repeat).
04-03-2013 12:24 PM - edited 04-03-2013 12:32 PM
@JDShaf wrote:
apok,
That was what I was trying to do but I couldn't get it to work. Here is the code I made to play around with the pause function. I couldn't get the program to continue after I hit the first pause.
Thanks.
looks like you have an inside out architecture...you can incase all the digital write code in a single while loop with case statements (i.e. statemachine). your command string can go inside each of the case statement structures,including the implicit switch properties.... transitions can happen with time delays or is dependent on the user inputs. your type of programming can go on and on, much like stacked sequences or flat sequences. write out a step by step procedure/sequences and if, then goto actions(transitions)....this would be a classic statemachine. try the online tuturials.....
your program is simple to recreate as a state machine, but complex in design,"think smarter, not harder?"