Limit Switch Troubles - HAL Debounce

More
6 years 6 months ago #165725 by andypugh
My fault:
[196544.357752] debounce: Unknown parameter `cgf'

(But then, you ought to be looking at the documentation too!)

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

More
6 years 6 months ago #165726 by andypugh

jay.perez1 wrote: Now it says that setp on line 120 requires two parameters but only one given.


Yes, that is because "setp" requires two parameters, but you only gave it one :-)

setp something value

I imagine you missed the value?

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

More
6 years 6 months ago #165730 by jay.perez1
I assume the missing parameter is the 2nd debounce time value. In the attached HAL file you can see how I attempted to do that with a second line of code.

Please don't make me spend four frustrating hours trying to decipher the cryptic (to me) manual just to try to implement this simple function. All past experience indicates that I will still not be successful without help.

Our team will get to the HAL when we're able to get together again. That won't be my role but right now I have the CNC Router at my house and therefore am best positioned to do this evaluation.

Jay

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

More
6 years 6 months ago #165850 by jay.perez1
Hello Andy,

Would you please look at this subset of my HAL and see if it makes sense to you and help me correct whatever it is I'm doing wrong ?

Thanks.

Jay



#
# DEBOUNCE TRIBULATIONS
#
# LCNC will start without errors with the following code. However, the debounce
# does not have any noticeable effect regardless if I use delay values of 20, 50,
# 100, 5000, 10000, or 20000. I suspect they're not being assigned to the 'ALL HOME' and
# the 'ALL LIMITS' properly.
#


loadrt debounce cfg=2

addf debounce.0 base-thread
setp debounce.0.delay 20000

net limit_raw parport.0.pin-12-in => debounce.0.0.in
net home_filtered debounce.0.0.out
net limit_filtered debounce.0.1.out


#
# FAILED ATTEMPT AT 2nd DEBOUNCE FOR HOMING
#
# addf debounce.1 base-thread
# setp debounce.1.delay 200
#


#
# DEBOUNCE ERRORS
#
# When I allow the net commands below to run I get an error message saying the
# limit switch axes have already been mapped to "ALL LIMITS" and LCNC doesn't start.
#


# net limit_raw parport.0.pin-00-in => debounce.0.0.in
# net limit_filt debounce.0.0.out

# net limit_filt axis.0.neg−lim−sw−in axis.0.pos-lim-sw-in
# net limit_filt axis.0.home-sw-in

# net limit_filt axis.1.neg−lim−sw−in axis.1.pos-lim-sw-in
# net limit_filt axis.1.home-sw-in

# net limit_filt axis.2.neg−lim−sw−in axis.2.pos-lim-sw-in
# net limit_filt axis.2.home-sw-in

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

More
6 years 6 months ago #165853 by andypugh
cfg = 2 gives you one group of two channels.

Both of those channels have the same debounce time and are serviced by the same function.

So cfg=2 needs
addf debounce.0 base-thread
setp debounce.0.20000

net something debouncee.0.0.....
net something-else debounce.0.1....

If you wanted two groups of one channel:
cfg = 1,1
addf debounce.0 base-thread
addf debounce 1 base-thread
setp debounce.0.time 100
setp debounce.1.time 20000

net something debounce.0.0......
net something-else debounce.1.0....

The reason that your current HAL doesn't do anything is that you are connecting the home-filtered and limit-filtered to debounce outputs, but you are not then connecting the signals to any motion inputs, to do anything.

Also, note that the numbers are thread cycles, so 20000 x 50,000nS (at a guess) so that is a 1s delay.
Code:
loadrt debounce cfg=1,1 addf debounce.0 base-thread addf debounce.1 base-thread setp debounce.0.delay 200 setp debounce.1.delay 2000 net limit_raw parport.0.pin-12-in => debounce.0.0.in debounce.1.0.in net home_filtered debounce.0.0.out net limit_filtered debounce.1.0.out net limit_filtered axis.0.neg−lim−sw−in axis.0.pos-lim-sw-in net home_filtered axis.0.home-sw-in net limit_filtered axis.1.neg−lim−sw−in axis.1.pos-lim-sw-in et home_filtered axis.1.home-sw-in net limit_filtered axis.2.neg−lim−sw−in axis.2.pos-lim-sw-in net home_filtered filt axis.2.home-sw-in

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

More
6 years 6 months ago #165891 by jay.perez1
Thanks Andy,

I think I understand the basics of the "loadrt debounce cfg=1,1" vs "cfg=2" but the concepts of 'Groups' and 'Channels' are something I haven't run into before and I don't understand them or how to apply them. I do understand from your explanation that I'd want "cfg=1,1" if I'd like different delays for the Homing and the Limits. I also understand the Delay values as you explained them and tried a very broad range to see if anything changed. Obviously it didn't as I don't have things coded properly.

I copied the code you provided in your last response and get two error messages when starting LCNC.

The first one is:
LINE 129: net limit_filtered axis.0.neg−lim−sw−in axis.0.pos-lim-sw-in

Debug file information:
.
./6040.hal:129: Pin 'axis.0.neg−lim−sw−in' does not exist
21753
Stopping realtime threads
Unloading hal components


If I comment out line 129 and start LCNC again I get the second error message:
LINE 130: net home_filtered axis.0.home-sw-in

Debug file information:
.
./6040.hal:130: Pin 'axis.0.home-sw-in' was already linked to signal 'all-limit-home'
21561
Stopping realtime threads
Unloading hal components

I suspect these errors would continue for the remaining axis.1 and axis.2 code.

Would you please look these over and help me finish getting the debounce working so I can continue with my evaluation ?

Thanks all your help so far and your efforts to edumacate me.

Jay

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

Time to create page: 0.297 seconds
Powered by Kunena Forum