physical start button + pause switch
- SenorAguas
- Offline
- Junior Member
-
Less
More
- Posts: 32
- Thank you received: 0
08 Dec 2016 17:12 #83784
by SenorAguas
Replied by SenorAguas on topic physical start button + pause switch
When I have some free time, I may try this. Thanks for your help!
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Offline
- Platinum Member
-
Less
More
- Posts: 4976
- Thank you received: 1373
08 Dec 2016 18:21 #83791
by Todd Zuercher
Replied by Todd Zuercher on topic physical start button + pause switch
I think I have a handle on what the problem might be (why you get the odd error messages), but you need to share your complete hal file(s)
Please Log in or Create an account to join the conversation.
- SenorAguas
- Offline
- Junior Member
-
Less
More
- Posts: 32
- Thank you received: 0
08 Dec 2016 20:34 #83811
by SenorAguas
Replied by SenorAguas on topic physical start button + pause switch
OK, here's my complete HAL file, also attached:
# Generated by stepconf 1.1 at Tue Nov 8 05:07:19 2016
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt hal_parport cfg="0 out"
setp parport.0.reset-time 1000
loadrt stepgen step_type=0,0,0
loadrt charge_pump
net estop-out charge-pump.enable iocontrol.0.user-enable-out
net charge-pump <= charge-pump.out
loadrt minmax count=2
addf minmax.0 servo-thread
addf minmax.1 servo-thread
net xmaxferror axis.0.f-error minmax.0.in
net ymaxferror axis.1.f-error minmax.1.in
loadrt and2 count=2
loadrt or2 count=1
addf and2.0 servo-thread
addf and2.1 servo-thread
addf or2.0 servo-thread
# External Program Pause and Run Buttons
# Run Section
net run-step-btn or2.0.in0 and2.1.in0 <= parport.0.pin-13-in
net pause-on and2.1.in1 <= halui.program.is-paused
net my-or1 or2.0.in1 <= and2.1.out
net run-sig halui.mode.auto halui.program.run <= or2.0.out
# Pause Section
net pause-resume-btn and2.0.in0 <= parport.0.pin-15-in-not
net run-on and2.0.in1 <= halui.program.is-running
net pause-sig halui.program.stop <= and2.0.out
setp halui.mode.teleop 1
addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf charge-pump base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread
addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
net coolant-mist <= iocontrol.0.coolant-mist
net coolant-flood <= iocontrol.0.coolant-flood
net xstep => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
setp parport.0.pin-03-out-invert 1
net xdir => parport.0.pin-03-out
net ystep => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
setp parport.0.pin-05-out-invert 1
net ydir => parport.0.pin-05-out
net coolant-mist => parport.0.pin-06-out
net coolant-flood => parport.0.pin-07-out
setp parport.0.pin-08-out-invert 1
net xenable => parport.0.pin-08-out
net xenable => parport.0.pin-16-out
net charge-pump => parport.0.pin-17-out
net home-y <= parport.0.pin-11-in
net home-x <= parport.0.pin-12-in
setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 11200
setp stepgen.0.dirsetup 11200
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable
net home-x => axis.0.home-sw-in
setp stepgen.1.position-scale [AXIS_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 11200
setp stepgen.1.dirsetup 11200
setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable axis.1.amp-enable-out => stepgen.1.enable
net home-y => axis.1.home-sw-in
net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Offline
- Platinum Member
-
Less
More
- Posts: 4976
- Thank you received: 1373
08 Dec 2016 22:14 #83813
by Todd Zuercher
Replied by Todd Zuercher on topic physical start button + pause switch
I'm still not sure where the error is coming from, I had an idea but it doesn't seem to be the problem. Tests I've been running in a simulation have not been reproducing it.
It sometimes matters the order that you add things to threads, so it is a good idea to have all of them in one place in the hal file.
I did a little tidying up, and removed a bunch of needless hal logic.
Give it a try and see if it works any better.
It sometimes matters the order that you add things to threads, so it is a good idea to have all of them in one place in the hal file.
I did a little tidying up, and removed a bunch of needless hal logic.
Give it a try and see if it works any better.
Please Log in or Create an account to join the conversation.
- SenorAguas
- Offline
- Junior Member
-
Less
More
- Posts: 32
- Thank you received: 0
08 Dec 2016 22:41 #83817
by SenorAguas
Replied by SenorAguas on topic physical start button + pause switch
Thanks, it worked the same as far as I can tell. Still had the same error message during certain moves, which seemed to be the interpolated moves.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Offline
- Platinum Member
-
Less
More
- Posts: 4976
- Thank you received: 1373
09 Dec 2016 03:56 #83824
by Todd Zuercher
Replied by Todd Zuercher on topic physical start button + pause switch
Sorry, I really don't know, right now I can't seem to reproduce the error message. What version Linuxcnc and what OS are you using?
Please Log in or Create an account to join the conversation.
09 Dec 2016 19:09 #83836
by an92626
Replied by an92626 on topic physical start button + pause switch
SenorAguas
I happened upon your thread because I was having the same problem getting the "can't do that" error message. Operationally it did not cause a problem, it was just annoying getting the error message.
I seem to have resolved my problem by pausing and then stopping.
You may wish to try editing your hal file in the pause section.
Just before you have the statement: net pause-sig halui.program.stop <= and2.0.out,
you may wish to trying adding the statement:net pause-sig halui.program.pause <= and2.0.out
This is what I did and from the limiting testing I did it seemed to stop the "can't do that" error message. I can not give you an explanation why it worked, but there are many things in linuxcnc that I can not explain. It would be a quick test and if it gets rid of the annoying error message then you can move on. Pause the program and then stopping it should not make any difference operationally that I can tell.
I happened upon your thread because I was having the same problem getting the "can't do that" error message. Operationally it did not cause a problem, it was just annoying getting the error message.
I seem to have resolved my problem by pausing and then stopping.
You may wish to try editing your hal file in the pause section.
Just before you have the statement: net pause-sig halui.program.stop <= and2.0.out,
you may wish to trying adding the statement:net pause-sig halui.program.pause <= and2.0.out
This is what I did and from the limiting testing I did it seemed to stop the "can't do that" error message. I can not give you an explanation why it worked, but there are many things in linuxcnc that I can not explain. It would be a quick test and if it gets rid of the annoying error message then you can move on. Pause the program and then stopping it should not make any difference operationally that I can tell.
Please Log in or Create an account to join the conversation.
- cncnoob1979
-
- Offline
- Platinum Member
-
Less
More
- Posts: 403
- Thank you received: 75
10 Dec 2016 02:05 #83873
by cncnoob1979
Here is my hal file that is using two physical buttons for what you are asking for. I hope it helps, my hal is a work in progress. So dont mind the mess please!
Has worked fine for me in master and previous versions.
Replied by cncnoob1979 on topic physical start button + pause switch
Warning: Spoiler!
# Generated by PNCconf at Mon Jan 18 14:56:08 2016
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
loadrt [KINS]KINEMATICS
#autoconverted trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt hostmot2
loadrt hm2_pci config=" num_encoders=5 num_pwmgens=5 num_stepgens=0 sserial_port_0=100xxx"
setp hm2_5i25.0.watchdog.timeout_ns 5000000
loadrt pid names=pid.x,pid.y,pid.z,pid.s
loadrt oneshot names=os1,os2,os3,os4,os5
loadrt not count=4
loadrt conv_float_s32 names=cnvf,cnvr,cnvs
loadrt debounce cfg=2
loadrt and2 count=12
loadrt or2 count=10
loadrt toggle count=1
loadrt toggle2nist count=1
loadrt flipflop names=ff1,ff2
loadrt near count=2
loadrt scale names=scale.sp,scale.jog,scale-fo,scale-ro,scale-so,scale-maxa
loadrt abs names=abs.spindle
loadrt lowpass names=lowpass.spindle
loadrt limit1 count=2
loadrt limit2 count=1
loadrt mux2 count=3
addf hm2_5i25.0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf pid.x.do-pid-calcs servo-thread
addf pid.y.do-pid-calcs servo-thread
addf pid.z.do-pid-calcs servo-thread
addf pid.s.do-pid-calcs servo-thread
addf hm2_5i25.0.write servo-thread
addf os1 servo-thread
addf os2 servo-thread
addf os3 servo-thread
addf os4 servo-thread
addf os5 servo-thread
addf not.0 servo-thread
addf not.1 servo-thread
addf not.2 servo-thread
addf cnvf servo-thread
addf cnvr servo-thread
addf cnvs servo-thread
addf debounce.0 servo-thread
addf and2.0 servo-thread
addf and2.1 servo-thread
addf and2.2 servo-thread
addf and2.3 servo-thread
addf and2.4 servo-thread
addf and2.5 servo-thread
addf and2.6 servo-thread
addf and2.7 servo-thread
addf and2.8 servo-thread
addf and2.9 servo-thread
addf and2.10 servo-thread
addf and2.11 servo-thread
addf or2.0 servo-thread
addf or2.1 servo-thread
addf or2.2 servo-thread
addf or2.3 servo-thread
addf or2.4 servo-thread
addf or2.5 servo-thread
addf or2.6 servo-thread
addf or2.7 servo-thread
addf or2.8 servo-thread
addf or2.9 servo-thread
addf toggle.0 servo-thread
addf toggle2nist.0 servo-thread
addf ff1 servo-thread
addf ff2 servo-thread
addf near.0 servo-thread
addf near.1 servo-thread
addf scale.sp servo-thread
addf scale.jog servo-thread
addf scale-fo servo-thread
addf scale-ro servo-thread
addf scale-so servo-thread
addf scale-maxa servo-thread
addf abs.spindle servo-thread
addf lowpass.spindle servo-thread
addf limit1.0 servo-thread
addf limit1.1 servo-thread
addf limit2.0 servo-thread
addf mux2.0 servo-thread
addf mux2.1 servo-thread
addf mux2.2 servo-thread
######################################################################################
######################################################################################
######################################################################################
#################################### AXIS HAL ########################################
######################################################################################
######################################################################################
######################################################################################
#########################################--- "ESTOP-OUT" ---##############
# "Estop output logic" ###
# "Enables 10CR to enable power up" ###
# "Drives DC Interlock relay" ###
# --- "ESTOP-OUT" ---#####################################################
net estop-out hm2_5i25.0.7i77.0.0.output-00
net machine-is-enabled hm2_5i25.0.7i77.0.0.output-01
###################################################################
# "Overrides" #
###################################################################
# "Read analog inputs from the override knobs. Full scale will be"#
# "approximately 24v. Scale the input accordingly. 1.0 = 100%" #
# #
# "Scale up the raw values 100x so that when converted to" #
# "integers we have good resolution." #
# "The results will be between 0 and 2400." #
###################################################################
################"--- Feed Override ---"##################
# Convert from float to S32 #
#########################################################
# "Read in analog input and send to halui.feed-override"
# "Enable direct count input"
net scale_ovr => scale-fo.gain scale-ro.gain scale-so.gain
sets scale_ovr 100.0
#100
net fo-ena halui.feed-override.count-enable halui.feed-override.direct-value
sets fo-ena 1
# "Scale down the value to a percentage"
net scf-scale => halui.feed-override.scale
sets scf-scale 0.000852
net scf-raw scale-fo.in <= hm2_5i25.0.7i77.0.0.analogin0
net scf-raw-adj cnvf.in <= scale-fo.out
net scf-s halui.feed-override.counts <= cnvf.out
################"--- Rapid Override ---"#################
# Convert from float to S32 #
#########################################################
# "Read in analog input and send to halui.rapid-override"
# "Enable direct count input"
net ro-ena halui.rapid-override.count-enable halui.rapid-override.direct-value
sets ro-ena 1
# "Scale down the value to a percentage"
net scr-scale => halui.rapid-override.scale
sets scr-scale 0.00044
net scr-raw scale-ro.in <= hm2_5i25.0.7i77.0.0.analogin1
net scr-raw-adj cnvr.in <= scale-ro.out
net scr-s halui.rapid-override.counts <= cnvr.out
###############"--- Spindle Override ---"################
# Convert from float to S32 #
#########################################################
# "Read in analog input and send to halui.spindle-override"
# "Enable direct count input"
net so-ena halui.spindle-override.count-enable halui.spindle-override.direct-value
sets so-ena 1
# "Scale down the value to a percentage"
net scs-scale => halui.spindle-override.scale
sets scs-scale 0.0005
#0.0005
# "Add an offest so that we have a minimum override of 30%"
#net scs-offset => scale-so.offset
#sets scs-offset 100
net scs-raw scale-so.in <= hm2_5i25.0.7i77.0.0.analogin2
net scs-raw-adj cnvs.in <= scale-so.out
net scs-s halui.spindle-override.counts <= cnvs.out
#########################################################
# "External Pause/Resume Section" [Stop] #
#########################################################
setp debounce.0.delay 20
net pause-resume-btn and2.0.in0 and2.1.in0 <= hm2_5i25.0.7i77.0.0.input-17-not
net pause-on toggle2nist.0.is-on and2.0.in1 and2.3.in1 <= halui.program.is-paused
net run-on and2.1.in1 <= halui.program.is-running
net pause-sig or2.0.in0 <= and2.0.out
net resume-sig or2.0.in1 <= and2.1.out
net toggle-ok toggle.0.in <= or2.0.out
net togglesig toggle2nist.0.in <= toggle.0.out
net toggleon halui.program.pause <= toggle2nist.0.on
net toggleoff halui.program.resume <= toggle2nist.0.off
#########################################################
# "External Run/Step Section" [Start] #
#########################################################
net run-step-btn and2.2.in0 and2.3.in0 <= hm2_5i25.0.7i77.0.0.input-16
net idle-on and2.2.in1 <= halui.program.is-idle
net run-sig halui.mode.auto halui.program.run <= and2.2.out
net step-sig halui.program.step <= and2.3.out
#####################################################################################
# "This is how The External Step/Pause buttons function:" #
#####################################################################################
# "Pressing Run/Step will begin executing a program. #
# Pressing Hold/Resume while a program is running will pause the program. #
# Pressing Run/Step while a program is paused will single step the program. #
# Pressing Hold/Resume while a program is paused will return it to normal run mode."#
#####################################################################################
#######################################################################
# "Manual Panel/Joystick Jog signals" #
#######################################################################
# "JOG X" #
#######################################################################
net jog-x-pos hm2_5i25.0.7i77.0.0.input-06 or2.4.in0
net jog-x-pos-p hm2_5i25.0.7i77.0.0.input-20 or2.4.in1
net or-out0 or2.4.out halui.axis.x.plus
net jog-x-neg hm2_5i25.0.7i77.0.0.input-07 or2.5.in0
net jog-x-neg-p hm2_5i25.0.7i77.0.0.input-21 or2.5.in1
net or-out1 or2.5.out halui.axis.x.minus
#######################################################################
# "JOG Y" #
#######################################################################
net jog-y-pos hm2_5i25.0.7i77.0.0.input-08 or2.6.in0
net jog-y-pos-p hm2_5i25.0.7i77.0.0.input-19 or2.6.in1
net or-out2 or2.6.out halui.axis.y.plus
net jog-y-neg hm2_5i25.0.7i77.0.0.input-09 or2.7.in0
net jog-y-neg-p hm2_5i25.0.7i77.0.0.input-18 or2.7.in1
net or-out3 or2.7.out halui.axis.y.minus
#######################################################################
# "JOG Z" #
#######################################################################
net jog-z-pos hm2_5i25.0.7i77.0.0.input-10 or2.8.in0
net jog-z-pos-p hm2_5i25.0.7i77.0.0.input-22 or2.8.in1
net or-out4 or2.8.out halui.axis.z.plus
net jog-z-neg hm2_5i25.0.7i77.0.0.input-11 or2.9.in0
net jog-z-neg-p hm2_5i25.0.7i77.0.0.input-23 or2.9.in1
net or-out5 or2.9.out halui.axis.z.minus
# "Using or2 with two inputs"
#net signal-a input-a => or2.0.in0
#net signal-b input-b => or2.0.in1
#net or-out or2.0.out => input
# "Joystick switches (currently unused)"
#net jog-continuous <= hm2_5i25.0.7i77.0.0.input-12
#############################################################
# "JOG Rates - Select the limited rate when we jog z minus" #
#############################################################
setp limit1.0.max 20
net jog-speed => limit1.0.in => mux2.0.in0
net jog-speed-lim <= limit1.0.out => mux2.0.in1
net jog-z-neg => mux2.0.sel
net jog-speed-sel <= mux2.0.out => halui.axis.jog-speed
###############################################################
# "Home switch inputs" #
###############################################################
net home-x <= hm2_5i25.0.7i77.0.0.input-13
net home-y <= hm2_5i25.0.7i77.0.0.input-14
net home-z <= hm2_5i25.0.7i77.0.0.input-15
#########################################################
# "X AXIS" #
#########################################################
setp pid.x.Pgain [JOINT_0]P
setp pid.x.Igain [JOINT_0]I
setp pid.x.Dgain [JOINT_0]D
setp pid.x.bias [JOINT_0]BIAS
setp pid.x.FF0 [JOINT_0]FF0
setp pid.x.FF1 [JOINT_0]FF1
setp pid.x.FF2 [JOINT_0]FF2
setp pid.x.deadband [JOINT_0]DEADBAND
setp pid.x.maxoutput [JOINT_0]MAX_OUTPUT
setp pid.x.error-previous-target true
setp pid.x.maxerror .0005
net x-index-enable <=> pid.x.index-enable
net x-enable => pid.x.enable
net x-pos-cmd => pid.x.command
net x-vel-cmd => pid.x.command-deriv
net x-pos-fb => pid.x.feedback
net x-output => pid.x.output
#############################################
# ---"X AXIS PWM Generator signals/setup"---#
#############################################
setp hm2_5i25.0.7i77.0.1.analogout0-scalemax [JOINT_0]OUTPUT_SCALE
setp hm2_5i25.0.7i77.0.1.analogout0-minlim [JOINT_0]OUTPUT_MIN_LIMIT
setp hm2_5i25.0.7i77.0.1.analogout0-maxlim [JOINT_0]OUTPUT_MAX_LIMIT
net x-output => hm2_5i25.0.7i77.0.1.analogout0
net x-pos-cmd joint.0.motor-pos-cmd
net x-enable joint.0.amp-enable-out
########################################
# "X AXIS enable _all_ sserial pwmgens"#
########################################
net x-enable hm2_5i25.0.7i77.0.1.analogena
################################################
# ---"X AXIS Encoder feedback signals/setup"---#
################################################
setp hm2_5i25.0.encoder.00.counter-mode 0
setp hm2_5i25.0.encoder.00.filter 1
setp hm2_5i25.0.encoder.00.index-invert 0
setp hm2_5i25.0.encoder.00.index-mask 0
setp hm2_5i25.0.encoder.00.index-mask-invert 0
setp hm2_5i25.0.encoder.00.scale [JOINT_0]ENCODER_SCALE
net x-pos-fb <= hm2_5i25.0.encoder.00.position
net x-vel-fb <= hm2_5i25.0.encoder.00.velocity
net x-pos-fb => joint.0.motor-pos-fb
net x-index-enable joint.0.index-enable <=> hm2_5i25.0.encoder.00.index-enable
net x-pos-rawcounts <= hm2_5i25.0.encoder.00.rawcounts
###################################################
# ---"X AXIS home / limit switch signals"--- #
###################################################
net home-x => joint.0.home-sw-in
net x-neg-limit => joint.0.neg-lim-sw-in
net x-pos-limit => joint.0.pos-lim-sw-in
#########################################################
# "Y AXIS" #
#########################################################
setp pid.y.Pgain [JOINT_1]P
setp pid.y.Igain [JOINT_1]I
setp pid.y.Dgain [JOINT_1]D
setp pid.y.bias [JOINT_1]BIAS
setp pid.y.FF0 [JOINT_1]FF0
setp pid.y.FF1 [JOINT_1]FF1
setp pid.y.FF2 [JOINT_1]FF2
setp pid.y.deadband [JOINT_1]DEADBAND
setp pid.y.maxoutput [JOINT_1]MAX_OUTPUT
setp pid.y.error-previous-target true
setp pid.y.maxerror .0005
net y-index-enable <=> pid.y.index-enable
net y-enable => pid.y.enable
net y-pos-cmd => pid.y.command
net y-vel-cmd => pid.y.command-deriv
net y-pos-fb => pid.y.feedback
net y-output => pid.y.output
#############################################
# ---"Y AXIS PWM Generator signals/setup"---#
#############################################
setp hm2_5i25.0.7i77.0.1.analogout1-scalemax [JOINT_1]OUTPUT_SCALE
setp hm2_5i25.0.7i77.0.1.analogout1-minlim [JOINT_1]OUTPUT_MIN_LIMIT
setp hm2_5i25.0.7i77.0.1.analogout1-maxlim [JOINT_1]OUTPUT_MAX_LIMIT
net y-output => hm2_5i25.0.7i77.0.1.analogout1
net y-pos-cmd joint.1.motor-pos-cmd
net y-enable joint.1.amp-enable-out
###############################################
# ---"Y AXIS Encoder feedback signals/setup"---#
###############################################
setp hm2_5i25.0.encoder.01.counter-mode 0
setp hm2_5i25.0.encoder.01.filter 1
setp hm2_5i25.0.encoder.01.index-invert 0
setp hm2_5i25.0.encoder.01.index-mask 0
setp hm2_5i25.0.encoder.01.index-mask-invert 0
setp hm2_5i25.0.encoder.01.scale [JOINT_1]ENCODER_SCALE
net y-pos-fb <= hm2_5i25.0.encoder.01.position
net y-vel-fb <= hm2_5i25.0.encoder.01.velocity
net y-pos-fb => joint.1.motor-pos-fb
net y-index-enable joint.1.index-enable <=> hm2_5i25.0.encoder.01.index-enable
net y-pos-rawcounts <= hm2_5i25.0.encoder.01.rawcounts
###################################################
# ---"Y AXIS home / limit switch signals"--- #
###################################################
net home-y => joint.1.home-sw-in
net y-neg-limit => joint.1.neg-lim-sw-in
net y-pos-limit => joint.1.pos-lim-sw-in
#########################################################
# "Z AXIS" #
#########################################################
setp pid.z.Pgain [JOINT_2]P
setp pid.z.Igain [JOINT_2]I
setp pid.z.Dgain [JOINT_2]D
setp pid.z.bias [JOINT_2]BIAS
setp pid.z.FF0 [JOINT_2]FF0
setp pid.z.FF1 [JOINT_2]FF1
setp pid.z.FF2 [JOINT_2]FF2
setp pid.z.deadband [JOINT_2]DEADBAND
setp pid.z.maxoutput [JOINT_2]MAX_OUTPUT
setp pid.z.error-previous-target true
setp pid.z.maxerror .0005
net z-index-enable <=> pid.z.index-enable
net z-enable => pid.z.enable
net z-pos-cmd => pid.z.command
net z-vel-cmd => pid.z.command-deriv
net z-pos-fb => pid.z.feedback
net z-output => pid.z.output
#############################################
# ---"Z AXIS PWM Generator signals/setup"---#
#############################################
setp hm2_5i25.0.7i77.0.1.analogout2-scalemax [JOINT_2]OUTPUT_SCALE
setp hm2_5i25.0.7i77.0.1.analogout2-minlim [JOINT_2]OUTPUT_MIN_LIMIT
setp hm2_5i25.0.7i77.0.1.analogout2-maxlim [JOINT_2]OUTPUT_MAX_LIMIT
net z-output => hm2_5i25.0.7i77.0.1.analogout2
net z-pos-cmd joint.2.motor-pos-cmd
net z-enable joint.2.amp-enable-out
################################################
# ---"Z AXIS Encoder feedback signals/setup"---#
################################################
setp hm2_5i25.0.encoder.02.counter-mode 0
setp hm2_5i25.0.encoder.02.filter 1
setp hm2_5i25.0.encoder.02.index-invert 0
setp hm2_5i25.0.encoder.02.index-mask 0
setp hm2_5i25.0.encoder.02.index-mask-invert 0
setp hm2_5i25.0.encoder.02.scale [JOINT_2]ENCODER_SCALE
net z-pos-fb <= hm2_5i25.0.encoder.02.position
net z-vel-fb <= hm2_5i25.0.encoder.02.velocity
net z-pos-fb => joint.2.motor-pos-fb
net z-index-enable joint.2.index-enable <=> hm2_5i25.0.encoder.02.index-enable
net z-pos-rawcounts <= hm2_5i25.0.encoder.02.rawcounts
###################################################
# ---"Z AXIS home / limit switch signals"--- #
###################################################
net home-z => joint.2.home-sw-in
net z-neg-limit => joint.2.neg-lim-sw-in
net z-pos-limit => joint.2.pos-lim-sw-in
#########################################################
# "SPINDLE" #
#########################################################
setp pid.s.Pgain [SPINDLE_9]P
setp pid.s.Igain [SPINDLE_9]I
setp pid.s.Dgain [SPINDLE_9]D
setp pid.s.bias [SPINDLE_9]BIAS
setp pid.s.FF0 [SPINDLE_9]FF0
setp pid.s.FF1 [SPINDLE_9]FF1
setp pid.s.FF2 [SPINDLE_9]FF2
setp pid.s.deadband [SPINDLE_9]DEADBAND
setp pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT
setp pid.s.error-previous-target true
setp pid.s.maxerror .0005
net spindle-index-enable <=> pid.s.index-enable
net spindle-enable => pid.s.enable
net spindle-vel-cmd-rpm => pid.s.command
net spindle-vel-fb-rpm => pid.s.feedback
net spindle-output <= pid.s.output
################################################
# ---"SPINDLE control signals"--- #
################################################
net spindle-vel-cmd-rps <= motion.spindle-speed-out-rps
net spindle-vel-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
net spindle-vel-cmd-rpm <= motion.spindle-speed-out
net spindle-vel-cmd-rpm-abs <= motion.spindle-speed-out-abs
#net spindle-enable <= motion.spindle-on
#net spindle-cw <= motion.spindle-forward
#net spindle-ccw <= motion.spindle-reverse
net spindle-brake <= motion.spindle-brake
net spindle-revs => motion.spindle-revs
net spindle-at-speed => motion.spindle-at-speed
net spindle-vel-fb-rps => motion.spindle-speed-in
net spindle-index-enable <=> motion.spindle-index-enable
#################################################
# ---"SPINDLE at speed signals"--- #
#################################################
sets spindle-at-speed true
#########################################################
# "MISC SIGNALS" #
#########################################################
net joint-select-a halui.axis.x.select
net x-is-homed halui.joint.0.is-homed
net jog-x-analog halui.axis.x.analog
net joint-select-b halui.axis.y.select
net y-is-homed halui.joint.1.is-homed
net jog-y-analog halui.axis.y.analog
net joint-select-c halui.axis.z.select
net z-is-homed halui.joint.2.is-homed
net jog-z-analog halui.axis.z.analog
net jog-selected-pos halui.axis.selected.plus
net jog-selected-neg halui.axis.selected.minus
net spindle-manual-cw halui.spindle.forward
net spindle-manual-ccw halui.spindle.reverse
net spindle-manual-stop halui.spindle.stop
net machine-is-on halui.machine.is-on
net MDI-mode halui.mode.is-mdi
###########################
# ---"coolant signals"---#
###########################
net coolant-mist <= iocontrol.0.coolant-mist
net coolant-flood <= iocontrol.0.coolant-flood
##############################################################
# "Probe input & output" #
##############################################################
#net probe-in <= hm2_5i25.0.7i77.0.0.input-23 => or2.3.in0
#net toolset-in <= hm2_5i25.0.7i77.0.0.input-24 => or2.3.in1
#net probe-signal <= or2.3.out => motion.probe-input
#"Output a short pulse to the probe LED/Beeper on contact"
#setp os5.falling FALSE
#setp os5.rising TRUE
#newsig os5Time float
#net os5Time => os5.width
#sets os5Time 0.02
#net probe-signal => os5.in
#net probe-led <= os5.out => hm2_5i25.0.7i77.0.0.output-10
net probe-in => motion.probe-input
##################################
# ---"motion control signals"---#
##################################
net in-position <= motion.in-position
net machine-is-enabled <= motion.motion-enabled
##########################
# ---"estop signals"--- #
##########################
net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in
#########################################################
# "Manual Tool Change" #
#########################################################
loadusr -W hal_manualtoolchange
net tool-change-request iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-change-confirmed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
#########################################################
# "SHARED JOGWHEEL MPG" #
#########################################################
net joint-selected-count <= hm2_5i25.0.encoder.03.count
#########################################
######### "for axis x MPG" #########
#########################################
setp joint.0.jog-vel-mode 0
setp axis.x.jog-vel-mode 0
net selected-jog-incr => joint.0.jog-scale axis.x.jog-scale
#net jog-ena-x => axis.x.jog-enable
net joint-selected-count => joint.0.jog-counts axis.x.jog-counts
#########################################
######### "for axis y MPG" #########
#########################################
setp joint.1.jog-vel-mode 0
setp axis.y.jog-vel-mode 0
net selected-jog-incr => joint.1.jog-scale axis.y.jog-scale
#net jog-ena-y => axis.y.jog-enable
net joint-selected-count => joint.1.jog-counts axis.y.jog-counts
#########################################
######### "for axis z MPG" #########
#########################################
setp joint.2.jog-vel-mode 0
setp axis.z.jog-vel-mode 0
# "Limit Z motion, should be about 20 FPM"
setp limit1.1.max [MPG]Z_MINUS_LIMIT
net selected-jog-incr => limit1.1.in
net selected-jog-incr-z <= limit1.1.out => joint.2.jog-scale axis.z.jog-scale
#net jog-ena-z => axis.z.jog-enable
net joint-selected-count => joint.2.jog-counts axis.z.jog-counts
# "Scale the jog rate (FPM) to an increment per Handwheel count"
setp scale.jog.gain [MPG]HAND_WHEEL_SCALE
net jog-speed => scale.jog.in
#########################################################
# "MPG JOG SELECTED" #
#########################################################
net jog-ena-z hm2_5i25.0.7i77.0.0.input-25 => axis.z.jog-enable
net jog-ena-z-not hm2_5i25.0.7i77.0.0.input-25-not => and2.11.in0
net jog-ena-x hm2_5i25.0.7i77.0.0.input-24 => axis.x.jog-enable
net jog-ena-x-not hm2_5i25.0.7i77.0.0.input-24-not => and2.11.in1
net jog-ena-y and2.11.out => axis.y.jog-enable
sets selected-jog-incr .000001
sets jog-speed 100
#########################################################
# "POST GUI FILE BERTHA Jog signals" #
#########################################################
#net jog-speed <= gscreen.jog-spd-out
#net jog-inc <= screen.jog-inc-out
#net jog-ena-x <= gscreen.jog-enable-x-out
#net jog-ena-y <= gscreen.jog-enable-y-out
#net jog-ena-z <= gscreen.jog-enable-z-out
Here is my hal file that is using two physical buttons for what you are asking for. I hope it helps, my hal is a work in progress. So dont mind the mess please!
![:) :)](/media/kunena/emoticons/smile.png)
Please Log in or Create an account to join the conversation.
Time to create page: 0.081 seconds