Run/Step Hold/Resume Buttons
- harindugamlath
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 18
05 Aug 2020 15:31 #177394
by harindugamlath
Replied by harindugamlath on topic Run/Step Hold/Resume Buttons
Thanks BigJohnT
This code works like a charm. I'm using Probe basic and it updates the gui too which is nice. But I would like to add some info so this might be helpful to someone.
In the original code the following lines should be changed according to your physical buttons. I mean Normally Open or Closed.
For the feed hold button,
net pause-resume-btn and2.0.in0 and2.1.in0 <= hm2_5i20.0.gpio.027.in_not (this is your input)
For the cycle start button,
net run-step-btn and2.2.in0 and2.3.in0 <= hm2_5i20.0.gpio.026.in_not (this is your input)
as we can see mesa card input has been inverted in both. This almost crashed my machine (partly my error when testing the G-code with a bad preset z height)
in Short if you have Normally closed switches (if your input stays true and goes false when you press) use the inverted pin.
if you have normally open switches(if your input stays false and goes true when you press) use the mesa pin without inverting.
what happened was original feed hold button on my machine was a normally closed one and the cycle start was normally open. Real fun part started when I try to hit the stop button on the gui as I saw I was having a wrong Z height. It just went back to normal cycle run. Pressing the Stop button again and again didn't help it just went in to normal cycle and Estop saved the day. Hope this helps someone else to be a bit less stupid than me.
What I ended up with - for feed hold (NC switch)
net pause-resume-btn and2.0.in0 and2.1.in0 <= hm2_5i25.0.7i76.0.0.input-31-not
for cycle start (No switch)
net run-step-btn and2.2.in0 and2.3.in0 <= hm2_5i25.0.7i76.0.0.input-30
This code works like a charm. I'm using Probe basic and it updates the gui too which is nice. But I would like to add some info so this might be helpful to someone.
In the original code the following lines should be changed according to your physical buttons. I mean Normally Open or Closed.
For the feed hold button,
net pause-resume-btn and2.0.in0 and2.1.in0 <= hm2_5i20.0.gpio.027.in_not (this is your input)
For the cycle start button,
net run-step-btn and2.2.in0 and2.3.in0 <= hm2_5i20.0.gpio.026.in_not (this is your input)
as we can see mesa card input has been inverted in both. This almost crashed my machine (partly my error when testing the G-code with a bad preset z height)
in Short if you have Normally closed switches (if your input stays true and goes false when you press) use the inverted pin.
if you have normally open switches(if your input stays false and goes true when you press) use the mesa pin without inverting.
what happened was original feed hold button on my machine was a normally closed one and the cycle start was normally open. Real fun part started when I try to hit the stop button on the gui as I saw I was having a wrong Z height. It just went back to normal cycle run. Pressing the Stop button again and again didn't help it just went in to normal cycle and Estop saved the day. Hope this helps someone else to be a bit less stupid than me.
What I ended up with - for feed hold (NC switch)
net pause-resume-btn and2.0.in0 and2.1.in0 <= hm2_5i25.0.7i76.0.0.input-31-not
for cycle start (No switch)
net run-step-btn and2.2.in0 and2.3.in0 <= hm2_5i25.0.7i76.0.0.input-30
Please Log in or Create an account to join the conversation.
23 Sep 2020 08:30 #183431
by raychar
Replied by raychar on topic Run/Step Hold/Resume Buttons
i encounter the same problem as what Jensor said about BigJohnT program, it works only for the Pause/Resume button but never on Run/Step one. If I deleted either one, the remained one in the program runs, of course this is not the solution.
Please Log in or Create an account to join the conversation.
23 Sep 2020 09:40 #183438
by rodw
Replied by rodw on topic Run/Step Hold/Resume Buttons
This code has worked perfectly for me for a number of years. If you are going to use some advanced hal stuff, you need to take responsibility for your machine. I always start by reviewing signals to make sure they are doing what I want them to do before building out the feature. If you use NC switches where NO switches are expected it on you to get it right.
Please Log in or Create an account to join the conversation.
01 Dec 2020 03:06 #190738
by Benb
Replied by Benb on topic Run/Step Hold/Resume Buttons
Raychar,
If I understand your problem, Hold/resume PB works, but run/step does not. However, if you delete or comment-out Hold/resume HAL net part of the configuration, the run/step part works. This tells me that your HAL configuration suffers from an order of execution of HAL components.
To solve this problem, I would draw function blocks of your hall configuration and decide which components should execute first.
You can set the order by adding a number at the end of each addf.
For more information how linuxcnc set the order of execution of the hall component.
linuxcnc.org/docs/2.7/html/man/man3/hal_..._to_thread.3hal.html
halui expects the signals to be debounced.
linuxcnc.org/docs/2.7/html/man/man1/halui.1.html
If I understand your problem, Hold/resume PB works, but run/step does not. However, if you delete or comment-out Hold/resume HAL net part of the configuration, the run/step part works. This tells me that your HAL configuration suffers from an order of execution of HAL components.
To solve this problem, I would draw function blocks of your hall configuration and decide which components should execute first.
You can set the order by adding a number at the end of each addf.
For more information how linuxcnc set the order of execution of the hall component.
linuxcnc.org/docs/2.7/html/man/man3/hal_..._to_thread.3hal.html
halui expects the signals to be debounced.
linuxcnc.org/docs/2.7/html/man/man1/halui.1.html
Please Log in or Create an account to join the conversation.
01 Dec 2020 18:03 #190783
by chris@cnc
Replied by chris@cnc on topic Run/Step Hold/Resume Buttons
Hi,
i have also one simple two button example.
One cycle start and one cycle pause.
was not easy to diff between start, idle and resume. But now it works...
addf and2.1 servo-thread
addf and2.2 servo-thread
net cycle-start hm2_7i76e.0.7i84.0.1.input-11
net cycle-pause halui.program.pause hm2_7i76e.0.7i84.0.1.input-12-not
net cycle-idle halui.program.is-idle
net cycle-ist-pause halui.program.is-paused
net cycle-start => and2.1.in0
net cycle-idle => and2.1.in1
net cycle-start => and2.2.in0
net cycle-ist-pause => and2.2.in1
net start halui.program.run and2.1.out
net weiter halui.program.resume and2.2.out
i have also one simple two button example.
One cycle start and one cycle pause.
was not easy to diff between start, idle and resume. But now it works...
addf and2.1 servo-thread
addf and2.2 servo-thread
net cycle-start hm2_7i76e.0.7i84.0.1.input-11
net cycle-pause halui.program.pause hm2_7i76e.0.7i84.0.1.input-12-not
net cycle-idle halui.program.is-idle
net cycle-ist-pause halui.program.is-paused
net cycle-start => and2.1.in0
net cycle-idle => and2.1.in1
net cycle-start => and2.2.in0
net cycle-ist-pause => and2.2.in1
net start halui.program.run and2.1.out
net weiter halui.program.resume and2.2.out
Please Log in or Create an account to join the conversation.
- The Feral Engineer
- Offline
- Senior Member
Less
More
- Posts: 79
- Thank you received: 22
13 Dec 2020 18:19 #191880
by The Feral Engineer
Replied by The Feral Engineer on topic Run/Step Hold/Resume Buttons
I do all of my HAL stuff in a sim before I copy/pasta to my real machine files
The following user(s) said Thank You: tommylight, Sadmeatball
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19196
- Thank you received: 6434
13 Dec 2020 18:27 #191883
by tommylight
I am hungry !
Replied by tommylight on topic Run/Step Hold/Resume Buttons
Pasta on a machine ?I do all of my HAL stuff in a sim before I copy/pasta to my real machine files
I am hungry !
Please Log in or Create an account to join the conversation.
- The Feral Engineer
- Offline
- Senior Member
Less
More
- Posts: 79
- Thank you received: 22
14 Dec 2020 03:23 #191939
by The Feral Engineer
Replied by The Feral Engineer on topic Run/Step Hold/Resume Buttons
It was supposed to be a reply to rodw
Please Log in or Create an account to join the conversation.
14 Dec 2020 04:34 #191940
by rodw
Man, I'm not even Italian!
I would think its hard to build out in a sim when you need to interact with real hardware.
Replied by rodw on topic Run/Step Hold/Resume Buttons
It was supposed to be a reply to rodw
Man, I'm not even Italian!
I would think its hard to build out in a sim when you need to interact with real hardware.
Please Log in or Create an account to join the conversation.
28 May 2024 14:45 #301678
by RoberCNC
Replied by RoberCNC on topic Run/Step Hold/Resume Buttons
Hello friends!! Maybe I should open a new thread but I'm writing here because after diving and researching in various posts this is the one that most closely resembles what I intend to do and so everything stays together and related. I should also mention that it has been a great discovery given that it is something I plan to do in the future and it's great for me, so thank you very much!!
I am trying to make the home all with an external (physical) button and a priori it seems simple, link the "halui.home-all" pin with the input signal of the MESA card and that's it, but things are getting complicated since it is linked with another button for the same on the MPG pendant. I deduce that it should be done using an "and" or similar to be able to operate both buttons interchangeably and here I am starting to get lost and I don't quite understand the logic or how I should do it.
Can you give me a hand?
I am trying to make the home all with an external (physical) button and a priori it seems simple, link the "halui.home-all" pin with the input signal of the MESA card and that's it, but things are getting complicated since it is linked with another button for the same on the MPG pendant. I deduce that it should be done using an "and" or similar to be able to operate both buttons interchangeably and here I am starting to get lost and I don't quite understand the logic or how I should do it.
Can you give me a hand?
Please Log in or Create an account to join the conversation.
Time to create page: 0.227 seconds