Run/Step Hold/Resume Buttons

More
14 Sep 2011 14:33 - 14 Sep 2011 14:34 #13201 by BigJohnT
fgauder wrote:

I have to say,it is nice to be able to tell your machine how to run instead of having to learn to or get used to running a machine someone else has configured. I am sold on EMC.

In the original post on this thread, I proposed 2 buttons, one a Run/Step and the other a Pause/Resume. The controller I converted from had those 2 buttons close to an e-stop and until a program was proved out, 2 fingers stayed on them.

Thanks to John and Andy, I got my Pause/Resume button. I did a little work on my own and was able to get the Run/Step button (admittedly the far easier). So, for what it's worth, here is the program for both buttons:

loadrt and2 count=4
loadrt or2 count=1
loadrt toggle count=1
loadrt toggle2nist count=1

addf and2.0 servo-thread
addf and2.1 servo-thread
addf and2.2 servo-thread
addf and2.3 servo-thread
addf or2.0 servo-thread
addf toggle.0 servo-thread
addf toggle2nist.0 servo-thread

# External Program Pause/Resume and Run/Step Buttons
# Pause/Resume Section
net pause-resume-btn and2.0.in0 and2.1.in0 <= hm2_5i20.0.gpio.027.in_not (this is your input)
net pause-on toggle2nist.0.is-on and2.0.in1 and2.3.in1 <= halui.program.is-paused
net run-on and2.1.in1 <= halui.program.is-running
net pause-sig or2.0.in0 <= and2.0.out
net resume-sig or2.0.in1 <= and2.1.out
net toggle-ok toggle.0.in <= or2.0.out
net togglesig toggle2nist.0.in <= toggle.0.out
net toggleon halui.program.pause <= toggle2nist.0.on
net toggleoff halui.program.resume <= toggle2nist.0.off
# Run/Step Section
net run-step-btn and2.2.in0 and2.3.in0 <= hm2_5i20.0.gpio.026.in_not (this is your input)
net idle-on and2.2.in1 <= halui.program.is-idle
# net pause.on and 2.3.in1 <= halui.program.is-paused
# and2.3.in1 was added in the net pause-on statement in Pause/Resume Section
net run-sig halui.mode.auto halui.program.run <= and2.2.out
net step-sig halui.program.step <= and2.3.out

This is how they function:

Pressing Run/Step will begin executing a program.

Pressing Hold/Resume while a program is running will pause the program.

Pressing Run/Step while a program is paused will single step the program.

Pressing Hold/Resume while a program is paused will return it to normal run mode.

I hope this thread is of some help to someone.

Frank

Last edit: 14 Sep 2011 14:34 by BigJohnT.
The following user(s) said Thank You: akb1212, dinkata, OT-CNC, besriworld, Sadmeatball, vasilyzel.

Please Log in or Create an account to join the conversation.

More
18 Aug 2016 05:11 - 18 Aug 2016 05:13 #78976 by dinkata
I used this scheme ,but not always work correctly .
If use pause ,resume work ok .
When the program went to change tool
then something happens and no continues .
pause ,resume not work !?

Excuse my language ,i use google translator . B)
Last edit: 18 Aug 2016 05:13 by dinkata.

Please Log in or Create an account to join the conversation.

More
18 Aug 2016 21:19 #79022 by newbynobi
That is for sure, because you use only T9 and the code has no M6!
So Linuxcnc only get the commands to prepare tool 9, but not to change it.

Norbert
The following user(s) said Thank You: dinkata

Please Log in or Create an account to join the conversation.

More
30 Aug 2016 19:22 - 30 Aug 2016 19:22 #79738 by OT-CNC
Replied by OT-CNC on topic Run/Step Hold/Resume Buttons
I just added the above code. Works nice. Thanks for posting. I noticed in rigid tapping mode the pause didnt seem to work or only after a long delay?
No big deal as I don't plan on pausing during that op. I was just cutting air and trying it out.
I'd like to add a physical stop button besides the two above, is there a complete code example out there I can copy and paste into my config that includes the program stop button? Thanks!
Last edit: 30 Aug 2016 19:22 by OT-CNC. Reason: spelling

Please Log in or Create an account to join the conversation.

More
01 Sep 2016 16:39 #79843 by andypugh

I just added the above code. Works nice. Thanks for posting. I noticed in rigid tapping mode the pause didnt seem to work or only after a long delay?


Stopping Z travel in a rigid tapping move will break parts, tooling and possibly machines. So LinuxCNC ignores you :-)

Please Log in or Create an account to join the conversation.

More
01 Sep 2016 23:15 - 01 Sep 2016 23:18 #79885 by OT-CNC
Replied by OT-CNC on topic Run/Step Hold/Resume Buttons
That's a good thing. We don't want broken taps. B)

How do I add the stop button? I found the example somewhere but can't find it again. Actually it would be nice to have the external stop button stop all motion in program run and mdi mode. I want to stop the spindle and the servos with a momentary push button.
Last edit: 01 Sep 2016 23:18 by OT-CNC. Reason: added momentary push button

Please Log in or Create an account to join the conversation.

More
02 Sep 2016 20:16 #79929 by andypugh

That's a good thing. We don't want broken taps. B)

How do I add the stop button? I found the example somewhere but can't find it again. Actually it would be nice to have the external stop button stop all motion in program run and mdi mode. I want to stop the spindle and the servos with a momentary push button.


Maybe motion.enable ?

linuxcnc.org/docs/2.7/html/man/man9/motion.9.html

Please Log in or Create an account to join the conversation.

More
13 Feb 2017 17:02 #87919 by jensor
Replied by jensor on topic Run/Step Hold/Resume Buttons
I think I found the problem of run/step not working consistently. I have run the file and only one time it ran as expected and unfortunately I have not had it do again. I find that the pin "halui.program-is-paused" goes true when initially pausing, however after a step is made it toggles false which prevents the next step command from getting through the "and" gate. I don't know why it does this, but it looks like that is the problem.
I hope that sometime the file runs as it should and then I can check on what that pin is doing.

Please Log in or Create an account to join the conversation.

More
13 Feb 2017 20:18 #87925 by rodw
Replied by rodw on topic Run/Step Hold/Resume Buttons

I think I found the problem of run/step not working consistently. I have run the file and only one time it ran as expected and unfortunately I have not had it do again. I find that the pin "halui.program-is-paused" goes true when initially pausing, however after a step is made it toggles false which prevents the next step command from getting through the "and" gate. I don't know why it does this, but it looks like that is the problem.
I hope that sometime the file runs as it should and then I can check on what that pin is doing.


I'm pretty sure that if you have problems, it will be in your implementation. When I installed this example, it worked perfectly from the very beginning. Could one of the logic and2's be in use by another part of your hal file or something like that?

Please Log in or Create an account to join the conversation.

More
13 Feb 2017 22:27 #87928 by jensor
Replied by jensor on topic Run/Step Hold/Resume Buttons
I am attaching a logic diagram of what I implemented. I think it is

This browser does not support PDFs. Please download the PDF to view it: Download PDF

the same logic.
Attachments:

Please Log in or Create an account to join the conversation.

Time to create page: 0.089 seconds
Powered by Kunena Forum