Debounce and Base-Thread Help Needed

More
23 Jan 2020 18:50 - 23 Jan 2020 18:52 #155565 by Mr. Technical
Hi Guys,

I recently installed a touch plate on an older LinuxCNC router installation and have tested it. While it works fine sometimes, it often throws a message about a jog move with probe input triggered. I chalk that up to needing a debounce function, which I am trying to get working.

I added the following to the custom.hal file:

# Include your custom HAL commands here
# This file will not be overwritten when you run PNCconf again

#added 1-22-20
#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<=hm2_5i25.0.7i76.0.0.input-04-not
net probe-in debounce.0.0.out=>motion.probe-input
#end of probe debouncing.

And added this to the M22-R6Probe.hal file:

# ---probe signal---

#remove the following two lines from (your machine).hal to
#make debounce fix added to custom.hal file work.
#This essentially breaks the original nets in the next two lines
#so they can be reconnected to the debounce function.

#net probe-in => motion.probe-input

#net probe-in => hm2_5i25.0.7i76.0.0.input-04-not

# on 1-19-20,added "-not" in previous line to invert probe-in signal due to adding 4.7K pull up resistor to circuit.)
# tool is grounded, and plate is tied to 24VDC through 4.7k resistor at input 04)

When I try to start LinuxCNC after those changes, I get the following debug message:

Debug file information:
Can not find -sec MOT -var MOT -num 1
Can not find -sec IO -var IO -num 1
Can not find -sec LINUXCNC -var NML_FILE -num 1
Can not find -sec EMC -var NML_FILE -num 1
HAL: ERROR: function 'debounce.0' not found
custom.hal:15: addf failed
10694
PID TTY STAT TIME COMMAND
Stopping realtime threads
Unloading hal components

I've attached the original files below for reference. Does anyone see what is wrong with how I'm trying to do this?
I suspect that the base-thread function is not loading properly, but don't know why.
All help is greatly appreciated.

Mr. Technical

File Attachment:

File Name: Debug_Message.txt
File Size:11 KB

File Attachment:

File Name: custom.hal
File Size:1 KB

File Attachment:

File Name: M22-R6Probe.hal
File Size:10 KB
Attachments:
Last edit: 23 Jan 2020 18:52 by Mr. Technical.

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

More
23 Jan 2020 20:47 #155571 by PCW
With Mesa cards a base thread is not normally used.
You could use debounce with an appropriate number
of servo thread periods.

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

More
23 Jan 2020 22:42 #155585 by Mr. Technical
Thanks for the info.

So, instead of: addf debounce.0 base-thread

I would use: addf debounce.0 servo-thread

What is typically a good delay value to use for debouncing a touch plate with servo-thread?
That is, what would I enter in this line copied from above?

setp debounce.0.delay 300

Thanks,
Mr. Technical

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

More
24 Jan 2020 01:13 #155609 by PCW
You might try 3 to 10 (3 to 10 ms at a 1 ms servo thread)

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

More
26 Jan 2020 12:31 #155798 by bbsr_5a
Dont use to many
SPACE Lines and also Comment lines #
from 2.8 update to 2.9 id id run in Problems on this issue
someone told me this
i removed this lines to a min at 2lines to the next and Wonders disapeard
Remember the planer does run to this files on regular bases this might interfear the system at Speed cuting

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

More
26 Jan 2020 13:06 #155805 by Clive S

bbsr_5a wrote: Dont use to many
SPACE Lines and also Comment lines #
from 2.8 update to 2.9 id id run in Problems on this issue
someone told me this
i removed this lines to a min at 2lines to the next and Wonders disapeard
Remember the planer does run to this files on regular bases this might interfear the system at Speed cuting


Is this true? As I like to add add a few spaces and ### In my files as I find then easier to read.

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

More
26 Jan 2020 21:02 #155853 by tommylight

Clive S wrote:

bbsr_5a wrote: Dont use to many
SPACE Lines and also Comment lines #
from 2.8 update to 2.9 id id run in Problems on this issue
someone told me this
i removed this lines to a min at 2lines to the next and Wonders disapeard
Remember the planer does run to this files on regular bases this might interfear the system at Speed cuting


Is this true? As I like to add add a few spaces and ### In my files as I find then easier to read.

This is the IO.hal file on some of my configs, no issues.
##########################################################################
############### EDIT BELOW THIS LINE for 7i96 ############################
##########################################################################
# Change the pins to corespond to inputs from THC or BOB for UP and DOWN signals
# For negative inputs use the omited part
#
#net MoveDown hm2_7i96.0.gpio.034.in => or2.0.in0
#
#net MoveUp hm2_7i96.0.gpio.035.in => or2.0.in1 mux2.1.sel
#
# Change the pins to corespond to Z-Home limit swith and ARCOK input from THC or BOB
# For negative inputs use the omited part
#
#net FloatSwitch hm2_7i96.0.gpio.036.in => or2.1.in1 and2.4.in0 and2.5.in1 and2.6.in1
#
#net ArcOK hm2_7i96.0.gpio.037.in => or2.4.in1 xor2.1.in1 oneshot.2.in
#
# Change the pin number to corespond to where your "spindle on" or relay is connected for starting the torch.
#
#net TorchOn => and2.3.out hm2_7i96.0.gpio.038.out oneshot.1.in not.2.in
##########################################################################
################################ EOF #####################################
##########################################################################

##########################################################################
############### EDIT BELOW THIS LINE for 7i76E ############################
##########################################################################
# Change the pins to corespond to inputs from THC or BOB for UP and DOWN signals
# For negative inputs use the omited part
#
#net MoveDown hm2_7i76e.0.7i76.0.0.input-00 => or2.0.in0
#
#net MoveUp hm2_7i76e.0.7i76.0.0.input-01 => or2.0.in1 mux2.1.sel
#
# Change the pins to corespond to Z-Home limit swith and ARCOK input from THC or BOB
# For negative inputs use the omited part
#
#net FloatSwitch hm2_7i76e.0.7i76.0.0.input-02 => or2.1.in1 and2.4.in0 and2.5.in1 and2.6.in1
#
#net ArcOK hm2_7i76e.0.7i76.0.0.input-03 => or2.4.in1 xor2.1.in1 oneshot.2.in
#
# Change the pin number to corespond to where your "spindle on" or relay is connected for starting the torch.
#
#net TorchOn => and2.3.out hm2_7i76e.0.7i76.0.0.output-00 oneshot.1.in not.2.in
##########################################################################
################################ EOF #####################################
##########################################################################


##########################################################################
############### EDIT BELOW THIS LINE for 7i77 ############################
##########################################################################
# Change the pins to corespond to inputs from THC or BOB for UP and DOWN signals
# For negative inputs use the omited part
#
net MoveDown torchud.move-down => or2.0.in0
#
net MoveUp torchud.move-up => or2.0.in1 mux2.1.sel
#
# Change the pins to corespond to Z-Home limit swith and ARCOK input from THC or BOB
# For negative inputs use the omited part
#
net FloatSwitch hm2_5i25.0.7i77.0.0.input-02 => or2.1.in1 and2.4.in0 and2.5.in1 and2.6.in1
#
net ArcOK torchud.arc-ok => or2.4.in1 xor2.1.in1 oneshot.2.in
#
# Change the pin number to corespond to where your "spindle on" or relay is connected for starting the torch.
#
net TorchOn => and2.3.out hm2_5i25.0.7i77.0.0.output-00 oneshot.1.in not.2.in
##########################################################################
################################ EOF #####################################
##########################################################################
The following user(s) said Thank You: Clive S

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

More
26 Jan 2020 22:02 #155863 by Clive S
Exactly B)
The following user(s) said Thank You: tommylight

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

More
05 Feb 2020 13:11 #156586 by andypugh

bbsr_5a wrote: Remember the planer does run to this files on regular bases this might interfear the system at Speed cuting


This is not true. The HAL file is parsed exactly once at system startup. It is used to move all the HAL pin pointers to the right places in the shared memory section. From that point on the HAL file is never used again.

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

Time to create page: 0.106 seconds
Powered by Kunena Forum