HAL using input pins multiple times
03 Apr 2016 01:37 #72601
by bogie6040
HAL using input pins multiple times was created by bogie6040
Hello all,
I am finally getting around to putting some external controls on my machine. I have some 5 position selector switches from the old control that I'm reusing. One is used to select the axis / feed override / spindle override and it works good - I had to use several and2 gates with the "-not" version of the four signals that actually do come from the switch to make up the fifth position.
I have two more switches one 5 position like the first and one that is two position push button momentary. I would like to setup these two in a combination so that the two position selects one of two options from each position of the 5 position switch - these are the two switches on the left hand side of the panel in the picture.
I have tried the same technique with this set of switches as the axis selector but it will not let me attach the same physical pin to different and2 gates multiple times. Now that I think about it that maybe the answer to my own question, I'll try putting all of the and2 gate inputs used in the other 5 positions tomorrow - I'm burnt out after a full day of sifting through the forum and manual pages.....
Is there a better way to do this?
Also is there a way to issue a touch off from a button for the axis selected by the switch??
Thanks,
Bogie
I am finally getting around to putting some external controls on my machine. I have some 5 position selector switches from the old control that I'm reusing. One is used to select the axis / feed override / spindle override and it works good - I had to use several and2 gates with the "-not" version of the four signals that actually do come from the switch to make up the fifth position.
I have two more switches one 5 position like the first and one that is two position push button momentary. I would like to setup these two in a combination so that the two position selects one of two options from each position of the 5 position switch - these are the two switches on the left hand side of the panel in the picture.
I have tried the same technique with this set of switches as the axis selector but it will not let me attach the same physical pin to different and2 gates multiple times. Now that I think about it that maybe the answer to my own question, I'll try putting all of the and2 gate inputs used in the other 5 positions tomorrow - I'm burnt out after a full day of sifting through the forum and manual pages.....
Is there a better way to do this?
Also is there a way to issue a touch off from a button for the axis selected by the switch??
Thanks,
Bogie
Please Log in or Create an account to join the conversation.
03 Apr 2016 11:17 - 03 Apr 2016 11:33 #72613
by BigJohnT
Replied by BigJohnT on topic HAL using input pins multiple times
You can use a signal over and over but not an input or output.
linuxcnc.org/docs/2.7/html/hal/basic-hal.html#_net
For a MPG with a selector switch simply connect each input to the correct jog enable pin
JT
linuxcnc.org/docs/2.7/html/hal/basic-hal.html#_net
For a MPG with a selector switch simply connect each input to the correct jog enable pin
net x-jog-select axis.0.jog-enable <= hm2_5i25.0.7i77.0.0.input-00
net y-jog-select axis.1.jog-enable <= hm2_5i25.0.7i77.0.0.input-01
net z-jog-select axis.2.jog-enable <= hm2_5i25.0.7i77.0.0.input-02
# MPG
setp hm2_5i25.0.encoder.05.counter-mode true
loadrt mux4 names=mpg-scale
addf mpg-scale servo-thread
loadrt ilowpass
addf ilowpass.0 servo-thread
loadrt or2 count=2
addf or2.0 servo-thread
addf or2.1 servo-thread
setp ilowpass.0.gain 0.02
setp ilowpass.0.scale 1000
setp mpg-scale.in0 0.0
setp mpg-scale.in1 -0.0000001
setp mpg-scale.in2 -0.000001
setp mpg-scale.in3 -0.00001
net jog-smoothing ilowpass.0.in <= hm2_5i25.0.encoder.05.count
net jog-position <= ilowpass.0.out
net jog-position => axis.0.jog-counts
net jog-position => axis.1.jog-counts
net jog-position => axis.2.jog-counts
net scale1 or2.0.in0 <= hm2_5i25.0.7i77.0.0.input-03
net scale2 or2.1.in0 <= hm2_5i25.0.7i77.0.0.input-04
net scale3 or2.0.in1 or2.1.in1 <= hm2_5i25.0.7i77.0.0.input-05
net pos2 mpg-scale.sel0 <= or2.0.out
net pos3 mpg-scale.sel1 <= or2.1.out
net axis-mpg-jog-scale axis.0.jog-scale <= mpg-scale.out
net axis-mpg-jog-scale axis.1.jog-scale <= mpg-scale.out
net axis-mpg-jog-scale axis.2.jog-scale <= mpg-scale.out
JT
Last edit: 03 Apr 2016 11:33 by BigJohnT.
Please Log in or Create an account to join the conversation.
03 Apr 2016 11:38 #72616
by BigJohnT
Replied by BigJohnT on topic HAL using input pins multiple times
Touching off to material with a pyvcp button. I use a 3/8" dowel to touch off.
postgui.hal
net z-material halui.mdi-command-10 <= pyvcp.z-material-touchoff
ini
MDI_COMMAND = G10 L20 P1 Z0.375
JT
postgui.hal
net z-material halui.mdi-command-10 <= pyvcp.z-material-touchoff
ini
MDI_COMMAND = G10 L20 P1 Z0.375
JT
Please Log in or Create an account to join the conversation.
04 Apr 2016 12:25 #72706
by andypugh
Here is another way to do this:
If you use a mux-generic with bit-inputs and unsigned32 output you can map any pattern of input bits to any pattern of output bits.
The output bits all end up encoded in a 32-bit int, so you then need a "bitslice" t extract them.
linuxcnc.org/docs/2.7/html/man/man9/mux_generic.9.html
linuxcnc.org/docs/2.7/html/man/man9/bitslice.9.html
A simplified example, 2 input bits giving the OR, AND and XOR outputs.
For a single output the LUT5 component is more elegant but the mux/bitslice way can handle more inputs and outputs (it can map 10 input pins to 32 output pins)
Replied by andypugh on topic HAL using input pins multiple times
I am finally getting around to putting some external controls on my machine. I have some 5 position selector switches from the old control that I'm reusing. One is used to select the axis / feed override / spindle override and it works good - I had to use several and2 gates with the "-not" version of the four signals that actually do come from the switch to make up the fifth position.
Here is another way to do this:
If you use a mux-generic with bit-inputs and unsigned32 output you can map any pattern of input bits to any pattern of output bits.
The output bits all end up encoded in a 32-bit int, so you then need a "bitslice" t extract them.
linuxcnc.org/docs/2.7/html/man/man9/mux_generic.9.html
linuxcnc.org/docs/2.7/html/man/man9/bitslice.9.html
A simplified example, 2 input bits giving the OR, AND and XOR outputs.
loadrt mux_generic config=bu4
loadrt bitslice personality=3
net bit0 parport.0.pin-00-in => mux-gen.00.sel-bit-000
net bit1 parport.0.pin-01-in => mux-gen.00.sel-bit-001
setp mux-gen.00.in-u32-00 0 # no bits set, all outputs zero
setp mux-gen.00.in-u32-01 3 # input bit zero set, set OR and XOR outputs
setp mux-gen.00.in-u32-02 3 # input bit one set, set OR and XOR outputs
setp mux-gen.00.in-u32-03 5 # input bit one and two set, set OR and AND outputs
net mux-out mux-gen.00.out-u32 => bitlsice.0.in
net OR-out bitslice.0.out-00
net XOR-out bitslice.0.out-01
net AND-out bitslice.0.out-02
For a single output the LUT5 component is more elegant but the mux/bitslice way can handle more inputs and outputs (it can map 10 input pins to 32 output pins)
Please Log in or Create an account to join the conversation.
Time to create page: 0.085 seconds