(SOLVED) need help adding debounce to probe

More
10 Apr 2017 18:25 - 14 Apr 2017 03:39 #91136 by Joebmh
I am trying to learn to probe using my DIY rotary axis. My machine runs g code great but when I probe, I must run the machine painfully slow or I will get false probe triggers. I think this is due to vibrations in my machine and bouncing of the probe with movement. I understand that I can add "debounce" to the HAL file to require the probe signal stay tripped for a given length of time but I can't figure out how. I am very new to Linux and don't understand what the different HAL instructions do. Below is my HAL file, any help will be greatly appreciated but please try and keep it very simple.
Thank you
Joe

# Generated by stepconf 1.1 at Tue Apr 4 00:20:48 2017
# 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 5000
loadrt stepgen step_type=0,0,0,0

addf parport.0.read base-thread
addf stepgen.make-pulses 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 spindle-cmd-rpm <= motion.spindle-speed-out
net spindle-cmd-rpm-abs <= motion.spindle-speed-out-abs
net spindle-cmd-rps <= motion.spindle-speed-out-rps
net spindle-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
net spindle-at-speed => motion.spindle-at-speed


net probe-in => motion.probe-input

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 ydir => parport.0.pin-04-out
net zdir => parport.0.pin-05-out
net astep => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1
net adir => parport.0.pin-07-out
setp parport.0.pin-14-out-invert 1
net xenable => parport.0.pin-14-out
net ystep => parport.0.pin-16-out
setp parport.0.pin-16-out-reset 1
net zstep => parport.0.pin-17-out
setp parport.0.pin-17-out-reset 1
net probe-in <= 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 50000
setp stepgen.0.dirsetup 50000
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

setp stepgen.1.position-scale [AXIS_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 50000
setp stepgen.1.dirsetup 50000
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

setp stepgen.2.position-scale [AXIS_2]SCALE
setp stepgen.2.steplen 1
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 50000
setp stepgen.2.dirsetup 50000
setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.2.step
net zdir <= stepgen.2.dir
net zenable axis.2.amp-enable-out => stepgen.2.enable

setp stepgen.3.position-scale [AXIS_3]SCALE
setp stepgen.3.steplen 1
setp stepgen.3.stepspace 0
setp stepgen.3.dirhold 50000
setp stepgen.3.dirsetup 50000
setp stepgen.3.maxaccel [AXIS_3]STEPGEN_MAXACCEL
net apos-cmd axis.3.motor-pos-cmd => stepgen.3.position-cmd
net apos-fb stepgen.3.position-fb => axis.3.motor-pos-fb
net astep <= stepgen.3.step
net adir <= stepgen.3.dir
net aenable axis.3.amp-enable-out => stepgen.3.enable

net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in

loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed 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
Last edit: 14 Apr 2017 03:39 by Joebmh.
The following user(s) said Thank You: EraDim

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

More
13 Apr 2017 13:43 #91307 by andypugh
Put this in your custom.hal file
loadrt debounce cfg=1
addf debounce.0 base-thread
setp debounce.0.delay 100
unlinkp motion.probe-input
net probe-in debounce.0.0.in
net probe-filt debounce.0.0.out => motion.probe-input

You might want to adjust the delay, currently set to 100 base-thread cycles.
The following user(s) said Thank You: Tchefter, Joebmh, EraDim

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

More
14 Apr 2017 03:53 #91341 by Joebmh
Thank you Andy Pugh for your reply! I had already gotten help from an old post on another forum but was waiting to make sure the problem was resolved before adding here. I was having problems because I setup the probe using stepconf wizard and kept getting an error because I had 2 sets of instructions for the same pin. I'm attaching my custom.hal file so maybe it'll help others.

#add this to custom.hal for probe debouncing
#change delay and pin number to fit your needs
loadrt debounce cfg=1
setp debounce.0.delay 300
addf debounce.0 base-thread
net debounce-probe-in debounce.0.0.in <= parport.0.pin-12-in
net probe-in debounce.0.0.out => motion.probe-input
#end of probe debouncing

#remove the following 2 lines from (your machine).hal or run stepconf wizard and remove probe from inputs
#net probe-in => motion.probe-input
#net probe-in <= parport.0.pin-12-in

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

More
14 Apr 2017 09:15 #91348 by andypugh
My HAL-snuppet includes a line to disconnect the motion.probe-input pin then re-arrange the connections.

You can make all the changes in the main HAL file, but that then means you can't use stepconf again.
(That is actually something that it makes sense to just accept once the system is working, from that point ignore stepconf and edit the config by hand)
The following user(s) said Thank You: Joebmh, EraDim

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

More
21 Apr 2017 15:13 #91790 by Joebmh
Thank you andypough, that explains what "unlinkp" does. I spent hours searching/reading the forum for debounce and probe and was mostly left more confused than before. After you replied to this post, I searched your user name and found several posts you had written that explained it where even a simple minded person like myself could easily understand. I wish I had found them sooner! It would be good if you would consider doing a separate tutorial on HAL editing and probing.

Thank you again for your help,
Joe

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

More
25 Jan 2022 07:01 #233038 by SrLange61
Thanks for the solution.I've now got gridprobe running using a cheap switch . I'm hoping to get Z level compensation running to mill and cut Depron on the glass. 
 
srl
Attachments:

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

Time to create page: 0.153 seconds
Powered by Kunena Forum