5 button select pendant

More
6 years 2 months ago #179839 by OT-CNC
Hi,

I'm modifying a mpg pendant code to read 5 momentary push buttons (NO) to activate the axis select. My previous hal (example attached) has a mux4 selector switch which will not work for this. What's the easiest solution? Mux_generic? Will that work with momentary push buttons? X, Y, Z, B, C. Also, do I need a debounce for this?
Anyone have a section of sample code I could implement?

TIA

Please Log in to join the conversation.

More
6 years 2 months ago #180081 by OT-CNC
Replied by OT-CNC on topic 5 button select pendant
Some more info, this is for gantry setup with twin Y. I was looking over the docs:
linuxcnc.org/docs/2.8/html/getting-start...dating-linuxcnc.html

I guess I need this to work in both teleop and joint jogging? I need to adapt this later to 5axiskins so I'd like some guidance on what build on.
The mpg will only have one Y button and need it linked to both Y and Y2 for jogging after homing.

Please Log in to join the conversation.

More
6 years 1 month ago #181164 by OT-CNC
Replied by OT-CNC on topic 5 button select pendant
I completed wiring up the remote pendant. I think I got it to work close to what I want. I can't fully test it yet as it's not hooked up to the machine, just to 7i77 on the bench for now. The HAL configuration seems to indicate that both y axes are indeed jogging together.
Can someone look it over please and give me heads up if I missed something obvious? I'd like to transfer this over to the machine and at some point to 5axiskins and don't want to rack the Y. Lacking 5 axis experience, I assume jogging will only occur in axis mode not joint?

The other item is, I'd like a possible option on the behavior of the halui.axis.L.select. On startup there is always X selected. The X changes when selecting another axis as expected. I would like the switch to be momentary latching. In other words, I would like to be able to turn off the selected X by pressing the same button again to deselect it. I assume I can't change this behavior as it's internal?

Hal attached.Some items left out (scale, loadrt, addf, counts etc) if you're copying/pasting. I may add final hal later if it works as planned.
Code:
#****************************** # connect miscellaneous signals #****************************** # ---HALUI signals--- #net axis-select-x halui.axis.x.select net jog-x-pos halui.axis.x.plus net jog-x-neg halui.axis.x.minus net jog-x-analog halui.axis.x.analog net x-is-homed halui.joint.0.is-homed #net axis-select-y halui.axis.y.select net jog-y-pos halui.axis.y.plus net jog-y-neg halui.axis.y.minus net jog-y-analog halui.axis.y.analog net y-is-homed halui.joint.1.is-homed net y2-is-homed halui.joint.2.is-homed #net axis-select-z halui.axis.z.select net jog-z-pos halui.axis.z.plus net jog-z-neg halui.axis.z.minus net jog-z-analog halui.axis.z.analog net z-is-homed halui.joint.3.is-homed #net axis-select-b halui.axis.b.select net jog-b-pos halui.axis.b.plus net jog-b-neg halui.axis.b.minus net jog-b-analog halui.axis.b.analog net b-is-homed halui.joint.4.is-homed #net axis-select-c halui.axis.c.select net jog-c-pos halui.axis.c.plus net jog-c-neg halui.axis.c.minus net jog-c-analog halui.axis.c.analog net c-is-homed halui.joint.5.is-homed net jog-selected-pos halui.axis.selected.plus net jog-selected-neg halui.axis.selected.minus net spindle-manual-cw halui.spindle.0.forward net spindle-manual-ccw halui.spindle.0.reverse net spindle-manual-stop halui.spindle.0.stop net machine-is-on halui.machine.is-on net jog-speed halui.axis.jog-speed net MDI-mode halui.mode.is-mdi # ---coolant signals--- net coolant-mist <= iocontrol.0.coolant-mist net coolant-flood <= iocontrol.0.coolant-flood # ---probe signal--- net probe-in => motion.probe-input ################################################################# ####### Remote Pendant ####### # ---jogwheel MPG signals to mesa encoder Shared MPG--- # mode1 is velocity mode, mode 0 is position and will continue to move. setp axis.x.jog-vel-mode 1 setp axis.y.jog-vel-mode 1 setp axis.z.jog-vel-mode 1 setp axis.b.jog-vel-mode 1 setp axis.c.jog-vel-mode 1 # scale select net scale1 mux4.0.sel0 <= [HMOT](CARD0).7i77.0.0.input-20 net scale2 mux4.0.sel1 <= [HMOT](CARD0).7i77.0.0.input-21 setp mux4.0.in0 0.0000005 setp mux4.0.in1 0.0000015 setp mux4.0.in2 0.0000010 setp mux4.0.in3 0.0000100 # connection to mesa enc0, pin 16,17 net mpg-out ilowpass.0.in <= [HMOT](CARD0).7i77.0.0.enc0.count ############### (A)jog enable with 5 NO push buttons, have to maintain button press durin MPG jog ######## # --- AXIS-SELECT-X--- #net mpg-x => axis.x.jog-enable <= [HMOT](CARD0).7i77.0.0.input-26 => [HMOT](CARD0).7i77.0.0.output-10 # --- AXIS-SELECT-Y-- #net mpg-y => axis.y.jog-enable <= [HMOT](CARD0).7i77.0.0.input-27 => [HMOT](CARD0).7i77.0.0.output-11 # --- AXIS-SELECT-Z--- #net mpg-z => axis.z.jog-enable <= [HMOT](CARD0).7i77.0.0.input-28 => [HMOT](CARD0).7i77.0.0.output-12 # --- AXIS-SELECT-B--- #net mpg-b => axis.b.jog-enable <= [HMOT](CARD0).7i77.0.0.input-29 => [HMOT](CARD0).7i77.0.0.output-13 # --- AXIS-SELECT-C--- #net mpg-c => axis.c.jog-enable <= [HMOT](CARD0).7i77.0.0.input-30 => [HMOT](CARD0).7i77.0.0.output-14 ############### (B) jog enable 5 NO push buttons halui stays selected untill next button press ############# # --- AXIS-SELECT-X--- net mpg-x => halui.axis.x.select <= [HMOT](CARD0).7i77.0.0.input-26 net mpg-x_select_state => halui.axis.x.is-selected => axis.x.jog-enable => [HMOT](CARD0).7i77.0.0.output-10 # --- AXIS-SELECT-Y-- net mpg-y => halui.axis.y.select <= [HMOT](CARD0).7i77.0.0.input-27 net mpg-y_select_state => halui.axis.y.is-selected => axis.y.jog-enable => [HMOT](CARD0).7i77.0.0.output-11 # --- AXIS-SELECT-Z--- net mpg-z => halui.axis.z.select <= [HMOT](CARD0).7i77.0.0.input-28 net mpg-z_select_state => halui.axis.z.is-selected => axis.z.jog-enable => [HMOT](CARD0).7i77.0.0.output-12 # --- AXIS-SELECT-B--- net mpg-b => halui.axis.b.select <= [HMOT](CARD0).7i77.0.0.input-29 net mpg-b_select_state => halui.axis.b.is-selected => axis.b.jog-enable => [HMOT](CARD0).7i77.0.0.output-13 # --- AXIS-SELECT-C--- net mpg-c => halui.axis.c.select <= [HMOT](CARD0).7i77.0.0.input-30 net mpg-c_select_state => halui.axis.c.is-selected => axis.c.jog-enable => [HMOT](CARD0).7i77.0.0.output-14 ################################## net mpg-scale <= mux4.0.out net mpg-scale => axis.x.jog-scale #net mpg-scale => axis.y.jog-scale net mpg-scale => axis.z.jog-scale net mpg-scale => axis.b.jog-scale net mpg-scale => axis.c.jog-scale ##invert y mpg rotation ## setp scale.1.gain -1 net mpg-scale scale.1.in net mpg-scale-invert scale.1.out => axis.y.jog-scale ## # ilowpass output is sent to each axis jog count # only selected axis will move # this is at beginning: loadrt ilowpass #setp ilowpass.0 servo-thread #setp ilowpass.0.scale 1000 #setp ilowpass.0.gain 0.020 net encoder-counts <= ilowpass.0.out net encoder-counts => axis.x.jog-counts net encoder-counts => axis.y.jog-counts net encoder-counts => axis.z.jog-counts net encoder-counts => axis.b.jog-counts net encoder-counts => axis.c.jog-counts ################ # connect pendant feed-override dial to mesa enc1 pin 18,19 net output [HMOT](CARD0).7i77.0.0.enc1.count => halui.feed-override.counts setp halui.feed-override.count-enable 1 setp halui.feed-override.scale 0.02 ################ ########################################################################################## ####connect pendant set zero (origin) button to selected axis net zero-set-button <= [HMOT](CARD0).7i77.0.0.input-22 addf and2.9 servo-thread addf and2.10 servo-thread addf and2.11 servo-thread addf and2.12 servo-thread addf and2.13 servo-thread ####### this works with (A) jog enable above ########### #net mpg-x => and2.9.in0 #net zero-set-button => and2.9.in1 #net zero-x <= and2.9.out => halui.mdi-command-00 #net mpg-y => and2.10.in0 #net zero-set-button => and2.10.in1 #net zero-y <= and2.10.out => halui.mdi-command-01 #net mpg-z => and2.11.in0 #net zero-set-button => and2.11.in1 #net zero-z <= and2.11.out => halui.mdi-command-02 #net mpg-b => and2.12.in0 #net zero-set-button => and2.12.in1 #net zero-b <= and2.12.out => halui.mdi-command-03 #net mpg-c => and2.13.in0 #net zero-set-button => and2.13.in1 #net zero-c <= and2.13.out => halui.mdi-command-04 ####### this works with (B) jog enable above ########## net mpg-x_select_state => and2.9.in0 net zero-set-button => and2.9.in1 net zero-x <= and2.9.out => halui.mdi-command-00 net mpg-y_select_state => and2.10.in0 net zero-set-button => and2.10.in1 net zero-y <= and2.10.out => halui.mdi-command-01 net mpg-z_select_state => and2.11.in0 net zero-set-button => and2.11.in1 net zero-z <= and2.11.out => halui.mdi-command-02 net mpg-b_select_state => and2.12.in0 net zero-set-button => and2.12.in1 net zero-b <= and2.12.out => halui.mdi-command-03 net mpg-c_select_state => and2.13.in0 net zero-set-button => and2.13.in1 net zero-c <= and2.13.out => halui.mdi-command-04 #################

Please Log in to join the conversation.

Time to create page: 0.119 seconds
Powered by Kunena Forum