Spindle CW and Stop Toggle Button
02 Mar 2024 19:20 - 02 Mar 2024 19:20 #294932
by N3pu
Spindle CW and Stop Toggle Button was created by N3pu
Hey
I want to add a hardware momentary pushbutton to Start the Spindle CW if it´s not turning.
If it´s turning (no matter if CW or CCW) and the Button is pushed again the Spindle should stop.
Could someone help me?
I just got the Button configured that it will run the spindle CW by pushing:
net spindle-manual-cw <= hm2_7i76e.0.7i76.0.0.input-11
But how should I handle the "if (hm2_7i76e.0.7i76.0.0.input-11 && (spindle-manual-cw OR spindle-manual-ccw)) then {spindle-manual-stop}" ?
Jannik
I want to add a hardware momentary pushbutton to Start the Spindle CW if it´s not turning.
If it´s turning (no matter if CW or CCW) and the Button is pushed again the Spindle should stop.
Could someone help me?
I just got the Button configured that it will run the spindle CW by pushing:
net spindle-manual-cw <= hm2_7i76e.0.7i76.0.0.input-11
But how should I handle the "if (hm2_7i76e.0.7i76.0.0.input-11 && (spindle-manual-cw OR spindle-manual-ccw)) then {spindle-manual-stop}" ?
Jannik
Last edit: 02 Mar 2024 19:20 by N3pu.
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19197
- Thank you received: 6434
02 Mar 2024 19:24 #294934
by tommylight
Replied by tommylight on topic Spindle CW and Stop Toggle Button
On the phone so not much help, but search for latch or flip-flop, both are included components of LinuxCNC and both can be used for it... or toggle, aslo included.
Please Log in or Create an account to join the conversation.
02 Mar 2024 21:08 #294947
by spumco
Replied by spumco on topic Spindle CW and Stop Toggle Button
My spindle control uses multiclick component to turn on CW or CCW. One press CW, double-press CCW. Second button for OFF.
With one button (only) you could have double-press STOP instead of CCW. Or one press STOP, double CW, triple CCW.
Here's what I use:
With one button (only) you could have double-press STOP instead of CCW. Or one press STOP, double CW, triple CCW.
Here's what I use:
signal BTN-SPIN0-ON connected to momentary pushbutton HAL-in pin.net BTN-SPIN0-ON => multiclick.s0.in
net SPIN-MAIN-FWD <= multiclick.s0.single-click-only
net SPIN-MAIN-FWD => halui.spindle.0.forward
net SPIN-MAIN-REV <= multiclick.s0.double-click-only
net SPIN-MAIN-REV => halui.spindle.0.reverse
net BTN-SPIN0-OFF => halui.spindle.0.stop
Please Log in or Create an account to join the conversation.
03 Mar 2024 08:10 #294988
by N3pu
Replied by N3pu on topic Spindle CW and Stop Toggle Button
Thank you.
I don´t know how to handle my "idea" with a flipflop or a toggle. I also read that some users did more or less similiar things with that kind of component, but not this exactly one. Multiclick sounds very interesting and easy, too. I didn´t knew before.
I wrote my kind of idea with an and + not component. I will give it a try today on the machine. For now it´s just written "offline":
I don´t know how to handle my "idea" with a flipflop or a toggle. I also read that some users did more or less similiar things with that kind of component, but not this exactly one. Multiclick sounds very interesting and easy, too. I didn´t knew before.
I wrote my kind of idea with an and + not component. I will give it a try today on the machine. For now it´s just written "offline":
# --- SPINDLE-MANUAL-CW AND OFF ---
#net spindle-manual-cw <= hm2_7i76e.0.7i76.0.0.input-11
#Create Spindle-Enable-NOT Signal
loadrt not count=1
addf not.0 sero-thread
net spindle-enable => not.0.in
net spindle-enable-not <= not.0.out
loadrt and2 count=2
#spindle-enable AND button_spindle THEN spindle Stop
addf and2.0 servo-thread
net spindle-enable => and2.0.in0
net button_spindle hm2_7i76e.0.7i76.0.0.input-11 => and2.0.in1
net spindle-manual-stop <= and2.0.out
#!spindle-enable AND button_spindle THEN spindle CW
addf and2.1 servo-thread
net spindle-enable-not => and2.1.in0
net button_spindle => and2.1.in1
net spindle-manual-cw <= and2.1.out
Please Log in or Create an account to join the conversation.
03 Mar 2024 09:40 #294997
by N3pu
Replied by N3pu on topic Spindle CW and Stop Toggle Button
This seems to work:
Thank you Guys. I begin to love this Software
loadrt and2 names=spindle_button.cw,spindle_button.stop
# --- SPINDLE-MANUAL-CW AND OFF ---
#net spindle-manual-cw <= hm2_7i76e.0.7i76.0.0.input-11
loadrt edge
addf edge.0 servo-thread
setp edge.0.in-edge FALSE
setp edge.0.out-width-ns 18000000
net button_spindle_full <= hm2_7i76e.0.7i76.0.0.input-11
net button_spindle_full => edge.0.in
net button_spindle <= edge.0.out
#Create Spindle-Enable-NOT Signal
loadrt not count=1
addf not.0 servo-thread
net spindle-enable => not.0.in
net spindle-enable-not <= not.0.out
#spindle-enable AND button_spindle THEN spindle Stop
addf spindle_button.stop servo-thread
net spindle-enable => spindle_button.stop.in0
net button_spindle => spindle_button.stop.in1
net spindle-manual-stop <= spindle_button.stop.out
#!spindle-enable AND button_spindle THEN spindle CW
addf spindle_button.cw servo-thread
net spindle-enable-not => spindle_button.cw.in0
net button_spindle => spindle_button.cw.in1
net spindle-manual-cw <= spindle_button.cw.out
Thank you Guys. I begin to love this Software
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19197
- Thank you received: 6434
03 Mar 2024 10:58 #295003
by tommylight
I was hooked the first time i edited a hal file, it was like entering a new universe of possibilities.
Replied by tommylight on topic Spindle CW and Stop Toggle Button
Welcome to the dark side!
Thank you Guys. I begin to love this Software
I was hooked the first time i edited a hal file, it was like entering a new universe of possibilities.
Please Log in or Create an account to join the conversation.
03 Mar 2024 14:21 #295048
by andypugh
Replied by andypugh on topic Spindle CW and Stop Toggle Button
Wait until you realise just how easy it is to write your own custom HAL components.
linuxcnc.org/docs/stable/html/hal/comp.html
linuxcnc.org/docs/stable/html/hal/comp.html
Please Log in or Create an account to join the conversation.
Time to create page: 0.073 seconds