On my lathe I fitted a 3-position switch, labelled with "on - auto - off". This allows me to override the G-code if required, to either on or off.
The HAL to do this looks like this:
Code:
net coolant-off hm2_7i84.008a.input-25
net coolant-on hm2_7i84.008a.input-26
loadrt mux_generic config="bb4"
addf mux-gen.00 servo-thread
net coolant-off mux-gen.00.sel-bit-00
net coolant-on mux-gen.00.sel-bit-01
net coolant-flood mux-gen.00.out-bit => hm2_7i84.008a.output-08
net coolant-auto iocontrol.0.coolant-flood mux-gen.00.in-bit-00
setp mux-gen.00.in-bit-01 0
setp mux-gen.00.in-bit-02 1
setp mux-gen.00.in-bit-03 0
Possibly not the simplest way, I suppose that it could have been done with simple AND and NOT components
coolant-out = (coolant _flood OR coolant_on) AND (NOT coolant_off)
Or even LUT5.
Truth-table for LUT5
Code:
coolant_flood | 0 1 0 1 0 1 0 1
coolant_on | 0 0 1 1 0 0 1 1
coolant_off | 0 0 0 0 1 1 1 1
coolant_out | 0 1 1 1 0 0 0 0
LUT5 Mask = 14 (0x0E)