Run/Step Hold/Resume Buttons
- BigJohnT
- Topic Author
- Offline
- Administrator
- Posts: 7330
- Thank you received: 1177
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
Please Log in or Create an account to join the conversation.
- dinkata
- Offline
- Premium Member
- Posts: 96
- Thank you received: 1
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 .
Please Log in or Create an account to join the conversation.
- newbynobi
- Offline
- Platinum Member
- Posts: 2075
- Thank you received: 406
So Linuxcnc only get the commands to prepare tool 9, but not to change it.
Norbert
Please Log in or Create an account to join the conversation.
- OT-CNC
- Offline
- Platinum Member
- Posts: 623
- Thank you received: 75
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!
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
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.
- OT-CNC
- Offline
- Platinum Member
- Posts: 623
- Thank you received: 75
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.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
That's a good thing. We don't want broken taps.
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.
- jensor
- Offline
- Premium Member
- Posts: 84
- Thank you received: 3
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.
- rodw
- Offline
- Platinum Member
- Posts: 10737
- Thank you received: 3541
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.
- jensor
- Offline
- Premium Member
- Posts: 84
- Thank you received: 3
Please Log in or Create an account to join the conversation.