LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to create a pause botton to pause a programme

Solved!
Go to solution

I would like to create pause button to pause the process.

Then a Run button that when pressed will continue from where it last stopped at. .

Attached is my programme. .

I would really like your help. .

Thank you. .

 

oh and the while loop outside the stacked sequence structure is so that my programme will run when the start button on the front panel is pressed. .

0 Kudos
Message 1 of 14
(3,836 Views)
Solution
Accepted by topic author Puchu

One simple approach would be to put the code in your While loop into the False case of a Case structure.  Wire a "Pause" boolean control to the case selector and set its On text to "Resume".  Put a small delay in the True case to prevent it from hogging the CPU during a pause and Bob will be your uncle.

 

Edit - make sure to set the mechanical action of the Pause boolean to Switch When Pressed/Released.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 14
(3,817 Views)

hi!

May I know what you mean by "set its On text to "Resume""? 

Sorry I'm new to LabVIEW. .

0 Kudos
Message 3 of 14
(3,792 Views)

Change the text that shows up on the boolean button.  Go to the properties dialog for that button.

0 Kudos
Message 4 of 14
(3,787 Views)

thanks! 

0 Kudos
Message 5 of 14
(3,775 Views)

hi. It still does not seem to be working for me. Sorry but could you help me see if I'm missing anything. . 

Thanks. .

0 Kudos
Message 6 of 14
(3,774 Views)

@jcarmody wrote:

One simple approach would be to put the code in your While loop into the False case of a Case structure [...]


You put the entire While loop into the Case structure; the Case structure belongs inside your loop.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 7 of 14
(3,762 Views)

oh yes!! it's working!! thank you so much! 😄

0 Kudos
Message 8 of 14
(3,734 Views)

hi. one more thing. I want to make a button which clears the waveform chart when pressed. . help please. . 

🙂

0 Kudos
Message 9 of 14
(3,717 Views)

@Puchu wrote:

hi. one more thing. I want to make a button which clears the waveform chart when pressed. . help please. . 

🙂


Add a case structure containing a property node for the chart history (right-click...create...property node...chart history)  and wire an empty array to it (right-click...create...constant). Wire a latch action button to the boolean selector of the case structure. Place the case structure in parallel to the existing case structure so you can clear the chart independently of the main case state.

 

 

A few more points.

  • You outer sequence frame is not needed. Simply wire from the first loop to the second loop boundary to create a data depedency.
  • Even better, eliminate the first loop and instead start the main loop in the pause mode. No start button needed. (Add more functionalty, and soon you have a state machine.)
  • Your "Equal FALSE" construct is clumsy. a simple "invert" will to the same.
  • You have a lot of duplicate code. It might be easier to operate on arrays instead.
  • Why do you need four identical diagram constants for all three conditions. One each is enough. Don't be afraid to branch a wire.
  • Coloring diagram constant will not color the string indicator wired to it. You need to change the propertied of the indicator.
0 Kudos
Message 10 of 14
(3,710 Views)