Remote Start/Hold Circuit
I'm trying to reproduce the functionality of my mill's old control, at least what worked well and I'm used to. I have a 3 axis mill running Axis 2.4.6 using Mesa 5i20, 7i33, and 7i37 boards. I converted it from an Anilam Series M control.
Thanks to the help I received here from Chris, Andy, and John and also from Peter, at Mesa, the mill is running well. Pncconf took care of the e-stop, limit switch, and servo drive enable circuits, once I got a clue as to how to physically wire the I/O board. Tuning has also come a long way, and even though it's not perfect, someone running the mill would probable never know it.
What I would like to do now is something that Pncconf doesn't offer, or so I believe. I have 2 remote NO momentary pushbuttons wired as inputs 3 and 4 on the 7i37. I would like to use them as Start and Hold buttons with the following functionality:
Pressing Start would begin executing a program.
Pressing Hold while a program is running would pause the program.
Pressing Start while a program is paused would single step the program.
Pressing Hold while a program is paused would return it to normal run mode.
In Axis the Pause button does what I want my Hold button to do, but you have to use the P (pause) and S (resume) keys on the keyboard to do the same as pushing the pause button twice. Axis uses the Play or R keys to begin a program and the Next or T keys for single step. So, it seems that the Hold button shouldn't be a problem, but can one button be used to both start and step as described above?
In Hal I believe I have to set the input pins as such:
setp hm2_5i20.0.gpio.026.is_input true
setp hm2_5i20.0.gpio.027.is_input true
Then I need to link the GPIO pins to HAL status pins with something like:
net remotestart hm2_5i20.0.gpio.026.in => halui.mode.auto halui.program.run
net remotehold hm2_5i20.0.gpio.027.in => halui.program.pause
Any corrections to the above would be appreciated, but even if they are correct, there is no provision for the Start button to step or the Hold button to resume. It seems like there needs to be some if/then logic, and I don't have a clue how to get there from here.
Thanks for what you are about to teach me.
Frank
Please Log in or Create an account to join the conversation.
John
Please Log in or Create an account to join the conversation.
Using your Pause/Resume example, I'm assuming I don't need the xml part because I have a real button. My other assumption is that the line (net pause-resume-btn and2.0.in0 and2.1.in0 <= pyvcp.pause-resume) is the only line I need to edit to get my button recognized. I make these assumptions admitting that the whole thing looks like Chinese to me.
Is the pause-resume-btn the Axis button and the pyvcp.pause-resume the part of the statement that I need to make hm2_5i20.0.gpio.027.in, or am I not even in the game?
custom.hal
loadrt and2 count=2
loadrt or2 count=1
loadrt toggle count=1
loadrt toggle2nist count=1
addf and2.0 servo-thread
addf and2.1 servo-thread
addf or2.0 servo-thread
addf toggle.0 servo-thread
addf toggle2nist.0 servo-thread
postgui.hal
# External Program Pause/Resume Button
net pause-resume-btn and2.0.in0 and2.1.in0 <= pyvcp.pause-resume
net pause-on toggle2nist.0.is-on and2.0.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
Thanks,
Frank
Please Log in or Create an account to join the conversation.
Yes, the pyvcp button is what you would replace with hm2_5i20.0.gpio.027.in.
No, the pause-resume-btn is a signal name.
Read this short intro to HAL that I wrote.
www.linuxcnc.org/docview/html/hal_basic_hal.html
Also make sure your not loading any of the components already in your base hal file. For example if you see in your base hal file a line like this loadrt or2 count=1 just change the count to 2 and adjust the or2.0 to or2.1.
Yea, a single button toggle is a bit confusing to grasp at first... maybe second or third time it might make sense. I think it took four times for me...
John
Please Log in or Create an account to join the conversation.
I put this in custom.hal:
loadrt and2 count=2
loadrt or2 count=1
loadrt toggle count=1
loadrt toggle2nist count=1
addf and2.0 servo-thread
addf and2.1 servo-thread
addf or2.0 servo-thread
addf toggle.0 servo-thread
addf toggle2nist.0 servo-thread
And this in custom_postgui.hal
# External Program Pause/Resume Button
net pause-resume-btn and2.0.in0 and2.1.in0 <= hm2_5i20.0.gpio.027.in_not
net pause-on toggle2nist.0.is-on and2.0.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
In halmeter the .027.in_not goes from false to true when I push the button, but it has no effect on either a paused or running program. All the Axis buttons still work as they did before. I checked syntax several times, there weren't any of the components already in the base file, and I am again clueless.
Thanks,
Frank
Please Log in or Create an account to join the conversation.
It looks spot on here is my hardinge.
# External Program Pause/Resume Button
net pause-resume-btn and2.3.in0 and2.4.in0 <= hm2_5i20.0.gpio.029.in_not
net pause-on toggle2nist.0.is-on and2.3.in1 <= halui.program.is-paused
net run-status and2.4.in1 <= halui.program.is-running
net pause-sig or2.5.in0 <= and2.3.out
net resume-sig or2.5.in1 <= and2.4.out
net toggle-ok toggle.0.in < or2.5.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
Is the postgui file being called in the HAL ini section? ie a like like the following in the HAL section.
POSTGUI_HALFILE = postgui.hal
John
Please Log in or Create an account to join the conversation.
The postgui file wasn't being called in the HAL ini section so I put the whole thing in the custom.hal file. It still didn't work. Then I realized that the custom.hal file wasn't being called in the HAL ini section either. I added CUSTOM_HALFILE = custom.hal. It didn't work either. I'm still lost.
Frank
Please Log in or Create an account to join the conversation.
The only valid tags are HALFILE and POSTGUI_HALFILE.The postgui file wasn't being called in the HAL ini section so I put the whole thing in the custom.hal file. It still didn't work. Then I realized that the custom.hal file wasn't being called in the HAL ini section either. I added CUSTOM_HALFILE = custom.hal. It didn't work either. I'm still lost.
linuxcnc.org/docs/html/config_ini_config...ub:%5BHAL%5D-section
So, if you had left the code in the postgui hal file and added a POSTGUI_HALFILE tag, or had put it in custom.hal and added a HALFILE = custom.hal it would have worked.
You can have any number of HALFILE tags, they get loaded/interpreted in sequence.
Please Log in or Create an account to join the conversation.
Frank
Please Log in or Create an account to join the conversation.
John
Please Log in or Create an account to join the conversation.