Switch between halui.jog.N.plus and halui.jog.N.increment-plus

More
7 years 3 months ago #138611 by Robban
Hi,

I want to be able to switch the jog input pin between continious and incremental.

Is it possible to switch them if i set the incremental value to 9?

Like this!
If halui.jog.N.increment =9 then
halui.jog.N.increment-plus
else
halui.jog.N.plus

halui.jog.N.increment is connected like this in custom_postgui.hal
net jog_selected_increment halui.jog.selected.increment halui.jog.0.increment halui.jog.2.increment <= 120p.jog_selected_increment

halui.jog.N.plus is connected like this in the hal file
net jog-x-pos <= hm2_5i25.0.7i76.0.0.input-00-not
net jog-x-pos halui.jog.0.plus

Attachment not found


Attachment not found

Please Log in to join the conversation.

More
7 years 3 months ago #138680 by Robban
Was able to figure something out.
Since im using a arduino to send commands from the emco 120 control panel i was able to use the python file that connects the arduino to linuxcnc to change the ports.
Code:
if left == 'inc': subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-00-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-00-not", "jog-x-pos-inc") subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-01-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-01-not", "jog-x-neg-inc") subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-02-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-02-not", "jog-z-pos-inc") subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-03-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-03-not", "jog-z-neg-inc") c["mode_auto"]= False c["mode_mdi"]= False c["mode_manual"]= True c['jog_selected_increment'] = float(right.lstrip("0"))/1000 if left == 'man': #print "man" c["mode_auto"]= False c["mode_mdi"]= False c["mode_manual"]= True c['jog_selected_increment'] = float(right.lstrip("0"))/1000 subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-00-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-00-not", "jog-x-pos") subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-01-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-01-not", "jog-x-neg") subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-02-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-02-not", "jog-z-pos") subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-03-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-03-not", "jog-z-neg") if left == 'aut': #print "aut" c["mode_mdi"]= False c["mode_manual"]= False c["mode_auto"]= True c['jog_selected_increment'] = float(right.lstrip("0"))/1000 subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-00-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-00-not", "jog-x-pos") subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-01-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-01-not", "jog-x-neg") subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-02-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-02-not", "jog-z-pos") subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-03-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-03-not", "jog-z-neg") if left == 'mdi': #print "mdi" c["mode_manual"]= False c["mode_auto"]= False c["mode_mdi"]= True c['jog_selected_increment'] = float(right.lstrip("0"))/1000 subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-00-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-00-not", "jog-x-pos") subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-01-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-01-not", "jog-x-neg") subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-02-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-02-not", "jog-z-pos") subprocess.call(["halcmd", "unlinkp", "hm2_5i25.0.7i76.0.0.input-03-not"]) hal.connect("hm2_5i25.0.7i76.0.0.input-03-not", "jog-z-neg")

Please Log in to join the conversation.

More
7 years 3 months ago #138694 by andypugh
I don't think that you should need to make and unmake HAL connections.

The first thing I would try would be to connect both halui.jog.N.increment-plus and halui.jog.N.plus to the same HAL signal, and see what happens
1) When increment is zero and velocity non-zero
2) When increment is non-zero and velocity is zero.

If that proved not work then I would use HAL logic to send the input pin value to one or other of the halui pins.

One way would be a set of "bb2" mux-generic components.
Set in0 of one and in1 of the other to zero, then connect in1 and in0 to the button input. One output can now drive the incremental jog pin and the other the continuous.
Switch between them based on the selector position.

You probably already have a mux to select the increments / speeds? If so then you could consider making the bb mux the same size, so that it can be controlled by the same selector HAL pin. any number of mux inputs can be wired to the same input value.

linuxcnc.org/docs/2.7/html/man/man9/mux_generic.9.html

Please Log in to join the conversation.

Time to create page: 0.140 seconds
Powered by Kunena Forum