toggling incremets with single button

More
12 Dec 2020 04:29 #191706 by The Feral Engineer
I want to set up buttons to step through the jog increments in GMOCCAPY, much like pressing the letter "i" on the keypad. Ultimately, i'd like to be able to step up and down through them or at least increment down with one button and return to continuous with another. The continuous selection is simple, it's the stepping that's giving me a hard time.

I'm new to hal, so i'm not sure what type of component would get me close to this. Every example i've seen uses a series of buttons or switch positions to get the increments and I want to do this with a single button.

Thanks in advance.

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

More
12 Dec 2020 05:37 #191712 by The Feral Engineer
figured it out, but i'm getting an error - command (EMC_JOG_STOP) cannot be executed until the machine is out of E-stop and turned on. Any insight?

Here's what I did:

loadrt multiswitch cfg=6
addf multiswitch.0 servo-thread

net step1 multiswitch.0.bit-00 gmoccapy.jog.jog-inc-0
net step2 multiswitch.0.bit-01 gmoccapy.jog.jog-inc-1
net step3 multiswitch.0.bit-02 gmoccapy.jog.jog-inc-2
net step4 multiswitch.0.bit-03 gmoccapy.jog.jog-inc-3
net step5 multiswitch.0.bit-04 gmoccapy.jog.jog-inc-4
net step6 multiswitch.0.bit-05 gmoccapy.jog.jog-inc-5

net stepdown multiswitch.0.down input.0.btn-start
net stepup multiswitch.0.up input.0.btn-select

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

More
16 Dec 2020 01:23 #192091 by nf1z
I was getting that same error. I am using three separate hardware inputs from a pendant rather than one button. This is basically the form of part of my postgui_custom.hal file:

net jog_0100 <= pina => gmoccapy.jog.jog-inc-3
net jog_0010 <= pinb => gmoccapy.jog.jog-inc-5
net jog_0001 <= pinc => gmoccapy.jog.jog-inc-7

With it like so, I get three alarms with the EMC_JOG_STOP message at startup. The way it was wired, one of the increment selection pins would always be on, but when I changed the code to ensure none of the pins are active at startup, I get no alarm.

I modified the hal code to gate all the pins with motion.motion-enabled, and this removed the alarms at startup. Since I also didn't want the pendant switch to affect the jog increment when not in use, I also gated them with a signal that's false when any axis is selected by the pendant. Or it could be a separate "deadman" switch, or a screen/pendant selector switch. I never used multiswitch, but you could probably arrange for all the multiswitch outputs that you are using to be off at power up by adding one more position and not using bit00. Or maybe a deadman or selector switch wired in series with the up and down buttons? My pendant actually has such buttons wired inside the pendant between the power and all of the buttons, but I didn't use them.

Hope this helps

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

More
19 Sep 2021 11:55 - 19 Sep 2021 12:30 #221079 by djewals
This is the easy (and shorter) way to prevent an error - command (EMC_JOG_STOP) in this case.
Increase the cfg with 1 and add  "setp multiswitch.0.position 0".

This is my setup:

# switching between jog increments
loadrt multiswitch cfg=9
addf multiswitch.0 servo-thread
setp multiswitch.0.position 0

# linking up and down buttons
net btn-y input.0.btn-y => multiswitch.0.down
net btn-a input.0.btn-a => multiswitch.0.up

net step1 multiswitch.0.bit-01 gmoccapy.jog.jog-inc-0
net step2 multiswitch.0.bit-02 gmoccapy.jog.jog-inc-1
net step3 multiswitch.0.bit-03 gmoccapy.jog.jog-inc-2
net step4 multiswitch.0.bit-04 gmoccapy.jog.jog-inc-3
net step5 multiswitch.0.bit-05 gmoccapy.jog.jog-inc-4
net step6 multiswitch.0.bit-06 gmoccapy.jog.jog-inc-5
net step7 multiswitch.0.bit-07 gmoccapy.jog.jog-inc-6
net step8 multiswitch.0.bit-08 gmoccapy.jog.jog-inc-7

Works flawlessly.
At the top and the bottom you have to click twice to loop around.
 
Last edit: 19 Sep 2021 12:30 by djewals.
The following user(s) said Thank You: tommylight

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

Time to create page: 0.067 seconds
Powered by Kunena Forum