enable external pin with input toggle switch

More
02 Feb 2025 17:36 - 02 Feb 2025 17:41 #320433 by Piton4ik
hi, i am studying Linuxcnc and I need to enable coolant on my lathe with an external switch,

my external switch connected to pin as:
net flood-switch <= [HMOT](CARD0).7i76.0.0.input-19 

an output coolant pin connected as:
# --- COOLANT-FLOOD ---
net coolant-flood  =>     [HMOT](CARD0).7i76.0.0.output-10

how connect  toogle to run flood?
i find this code but understand how it works in linuxcnc

net coolant-mist  =>     hm2_7i76e.0.7i76.0.0.output-14
net coolant-flood     <=  iocontrol.0.coolant-flood

and I find this lesson but don't understand how edit button code to google switch
all my attempts led to errors,

but this code is work good to spindle

net spindle-manual-cw     <=  [HMOT](CARD0).7i76.0.0.input-20

and my copy to coolant show error...

net coolant-mist     <=  [HMOT](CARD0).7i76.0.0.input-14


And I have a pneumatic spindle chuck and need connect 3 state toggle to open chuck and close chuck,
to open chuсk I receive input but need run 2 step(enable relay(M64 P0) and disable after 3 second(M65 P0))
to close chuсk I receive input and need run 2 step (enable relay(M64 P1) and disable after 3 second(M65 P1))
Maybe this type of chuck is turned on and off differently?
thank you
Attachments:
Last edit: 02 Feb 2025 17:41 by Piton4ik.

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

More
09 Feb 2025 18:24 #321085 by andypugh
Replied by andypugh on topic enable external pin with input toggle switch
I am not completely clear what you want to configure, but my own lathe has a three-position switch for coolant on, off and auto (in "auto" mode it runs according to the G-code flood coolant command)

I use a "mux" component. Specifically an 4-way bit-type mux_generix:
linuxcnc.org/docs/stable/html/man/man9/mux_generic.9.html
loadrt mux_generic config=bb4
net coolant-force-on hm2_{card}-in-NN => mux_gen.0.sel-bit-00 
net coolant-force-off hm2_{card}-in-MM => mux_gen.0.sel-bit-01

net coolant-flood mux_gen.0.in-bit-00
setp mux_gen.0.in-bit-01 1
setp mux_gen.0.in-bit-02 0
#should not be possible to have both sel inputs true, but...
setp mux_gen.0.in-bit-03 0

Basically if no sel inputs to the mux are set the it passes-through coolant-flood.
If the force-on input is set then hard-coded to on input 01 is used
force-off uses a hard-coded off.
The switch isn't capable of sending both force-on and force-off inputs, but I set that combo to 0 just to be tidy.

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

Time to create page: 0.045 seconds
Powered by Kunena Forum