HAL newbie struggling with debounce set up

More
10 years 10 months ago #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 to join the conversation.

More
10 years 10 months ago #66334 by andypugh

cmtunnel wrote: 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
Code:
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:
Code:
loadrt debounce cfg=3 show pin show param

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

Please Log in to join the conversation.

More
10 years 10 months ago #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 to join the conversation.

More
10 years 10 months ago #66367 by andypugh

cmtunnel wrote: 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)
Code:
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 to join the conversation.

More
10 years 10 months ago #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 to join the conversation.

More
10 years 10 months ago #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 to join the conversation.

More
10 years 10 months ago #66400 by cmtunnel
won't start yet but here's the .hal

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

Please Log in to join the conversation.

More
10 years 10 months ago #66402 by cncbasher
you have a typo it should be debounce.0.0.in & debounce.0.0.out etc

Please Log in to join the conversation.

More
10 years 10 months ago #66405 by andypugh

cncbasher wrote: 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 to join the conversation.

More
10 years 10 months ago #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

Please Log in to join the conversation.

Time to create page: 0.097 seconds
Powered by Kunena Forum