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: 

How to reuse front panel activity function

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.

0 Kudos
Message 1 of 9
(2,185 Views)

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?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(2,183 Views)

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 .

0 Kudos
Message 3 of 9
(2,176 Views)

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.

0 Kudos
Message 4 of 9
(2,171 Views)

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.

0 Kudos
Message 5 of 9
(2,165 Views)

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.

0 Kudos
Message 6 of 9
(2,161 Views)

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.

0 Kudos
Message 7 of 9
(2,151 Views)

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).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 9
(2,147 Views)

@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?"

0 Kudos
Message 9 of 9
(2,137 Views)