HAL newbie struggling with debounce set up

More
03 Dec 2015 22:27 #66328 by cmtunnel
I am having trouble understanding how to load and use debounce.

I'm entering:

cd linuxcnc
halrun
loadrt debounce

at this point i'm getting an error......could not insert module.......operation not permitted

not good with the terminal yet

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

More
03 Dec 2015 23:49 #66334 by andypugh

cd linuxcnc
halrun
loadrt debounce

at this point i'm getting an error......could not insert module.......operation not permitted


You don't actually need to cd to linuxcnc, though that is irrelevant.

If you type "man debounce" (in a separate terminal, not the halrun one) then you will see this page which says that the loadrt line is
loadrt debounce cfg=size[,size,...]

In man-page format [this is optional] and ... means "as many as you want"

So, to load 3 debounces that will all have the same debounce time:
loadrt debounce cfg=3
show pin
show param

don't forget also, if you want to see it working
loadrt threads
addf debounce.0 thread1
start

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

More
04 Dec 2015 02:15 #66346 by cmtunnel
I can't see it doing anything but I don't know what to look for. I will need this to run all the time for my limit switches. How do I set it up so that it runs inside linuxcnc? Or does it do that automatically?

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

More
04 Dec 2015 11:44 #66367 by andypugh

I can't see it doing anything but I don't know what to look for. I will need this to run all the time for my limit switches. How do I set it up so that it runs inside linuxcnc? Or does it do that automatically?


If you want to have this running in LinuxCNC , then you add the commands to the HAL file (except for the loadrt threads and start commands, those are handled by LinuxCNC)
loadrt debounce cfg=3
...
addf debounce.0 base-thread
setp debounce.0.delay 15
...
net switch-raw parport.0.pin-00-in => debounce.0.in
net switch-debounced debounce.0.out axis.0.pos-lim-sw-in  axis.0.neg-lim-sw-in  axis.0.home-sw-in
...

You will need to change signal and pin names to suit your actual HAL file, of course.

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

More
04 Dec 2015 17:34 #66398 by cmtunnel
so:

net switch-raw hm2_5i25.0.0.input-00-not => debounce.0.in
net switch-debounced debounce.0.out axis.0.pos-lim-sw-in axis.0.neg-lim-sw-in axis.0.home-sw-in

and then the same for y and z except 1's and 2's

net switch-raw hm2_5i25.0.0.input-01-not => debounce.1.in .................and so on??

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

More
04 Dec 2015 17:59 #66399 by andypugh
[quote="cmtunnel" post=66398.and so on??[/quote]

Yes.

You will have to remove/alter any existing HAL lines that conflict. (ie, try to net the same pins)

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

More
04 Dec 2015 18:27 #66400 by cmtunnel
won't start yet but here's the .hal

it doesn't like the addf but im looking into it now.
Attachments:

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

More
04 Dec 2015 19:16 #66402 by cncbasher
you have a typo it should be debounce.0.0.in & debounce.0.0.out etc
The following user(s) said Thank You: Alicee

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

More
04 Dec 2015 19:49 #66405 by andypugh

you have a typo it should be debounce.0.0.in & debounce.0.0.out etc


Ah yes.

cfg=1,2

would create input pins

debounce.0.0.in
debounce.1.0.in
debounce.1.1.in

All the debounce.0 has its own debounce time and debounce.1.0 and debounce.1.1 share a debounce time.

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

More
04 Dec 2015 20:10 #66409 by cmtunnel
I'm at a loss right now on this. i thought it was cfg=3. Could someone check my halfile please. thanks
Attachments:

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

Time to create page: 0.082 seconds
Powered by Kunena Forum