Limit Switch Troubles - HAL Debounce

More
27 Apr 2020 18:46 #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.
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
28 Apr 2020 02:06 #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.

More
28 Apr 2020 18:45 - 28 Apr 2020 18:45 #166001 by andypugh

jay.perez1 wrote: but the concepts of 'Groups' and 'Channels' are something I haven't run into before


I made them up on the spot to try to explain the setup. Clearly I chose badly if it isn't obvious what I meant.


I copied the code you provided in your last response and get two error messages when starting LCNC
./6040.hal:129: Pin 'axis.0.neg−lim−sw−in' does not exist


Somehow, somewhere, something has swapped the minus sign - for em-dashes − in that code. This might be my fault for using my Mac to reply. So, swap all the dashes for minus-signs.


./6040.hal:130: Pin 'axis.0.home-sw-in' was already linked to signal 'all-limit-home'


It looks like you have already linked the home switches earlier in the HAL file. You need to remove the lines that begin "net all-limit-home"
Last edit: 28 Apr 2020 18:45 by andypugh.

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

Time to create page: 0.141 seconds
Powered by Kunena Forum