Pendant with axis select buttons

23 Nov 2021 10:43 - 23 Nov 2021 10:46 #227392 by Wischi

i am trying to convert an original Deckel FPA pendant to LinuxCNC. The pendant has six buttons, normally open ,momentary, with a 24V LED. One for each of the Axis (X,Y,Z,C) and two for the scale (100,10). The scale buttons I set to 100 for 0.01mm and 10 for 0.1mm and C will be A on my machine at some point. I have the buttons working in HAL with their led and axis.N.jog-enable as well as the scale. But it is possible to select multiple axis and scales at the same time. My idea was to first select an axis and then the scale. Then when switching, for example, from X to Y, the X Led turns off and axis.x.jog-enable goes to 0 and Y led turns on and axis.y.jog-enable goes to 1. The scale will be unchanged. And when all axis switches are off the encoder would act as a feed override. But that is something for later on.

Here is my current HAL. I appreciate every tip on how to code in HAL since this is my first time doing something like this. For example the use of mux4, it works but I think it is not that good/correct to do.
loadrt toggle2nist count=6
loadrt toggle count=6
loadrt mux4 count=1

addf mux4.0 servo-thread

setp mux4.0.in0 0
setp mux4.0.in1 0.01
setp mux4.0.in2 0.1
setp mux4.0.in3 0

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.a.jog-scale

addf toggle2nist.0 servo-thread
addf toggle2nist.1 servo-thread
addf toggle2nist.2 servo-thread
addf toggle2nist.3 servo-thread
addf toggle2nist.4 servo-thread
addf toggle2nist.5 servo-thread

addf toggle.0 servo-thread
addf toggle.1 servo-thread
addf toggle.2 servo-thread
addf toggle.3 servo-thread
addf toggle.4 servo-thread
addf toggle.5 servo-thread

#Axis select buttons
net mpgx_btn <= hm2_7i92.0.7i77.0.0.input-00
net mpgx_btn_in axis.x.jog-enable hm2_7i92.0.7i77.0.0.output-00 <= toggle.0.out

net mpgy_btn <= hm2_7i92.0.7i77.0.0.input-01
net mpgy_btn_in axis.y.jog-enable hm2_7i92.0.7i77.0.0.output-01 <= toggle.1.out

net mpgz_btn <= hm2_7i92.0.7i77.0.0.input-02
net mpgz_btn_in axis.z.jog-enable hm2_7i92.0.7i77.0.0.output-02 <= toggle.2.out

net mpga_btn <= hm2_7i92.0.7i77.0.0.input-03
net mpga_btn_in axis.a.jog-enable hm2_7i92.0.7i77.0.0.output-03 <= toggle.3.out

#Scale buttons
net mpg10_btn <= hm2_7i92.0.7i77.0.0.input-05
net mpg10_btn_in mux4.0.sel0 hm2_7i92.0.7i77.0.0.output-04 <= toggle.4.out

net mpg100_btn <= hm2_7i92.0.7i77.0.0.input-04
net mpg100_btn_in mux4.0.sel1 hm2_7i92.0.7i77.0.0.output-05 <= toggle.5.out 
Last edit: 23 Nov 2021 10:46 by Wischi.

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

23 Nov 2021 17:00 #227421 by Henk
I would have used classic ladder for this. But that is just my preference....

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

Time to create page: 0.060 seconds
Powered by Kunena Forum