Debounce

More
06 Mar 2021 16:17 #201196 by madguernseyboy
Debounce was created by madguernseyboy
Good day

Can someone help implement the debounce on my HAL file for the 3 home switches.

Just not sure how its supposed to be.

Thank you

Brendan
Attachments:

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

More
06 Mar 2021 21:00 #201214 by madguernseyboy
Replied by madguernseyboy on topic Debounce
I found the solution.

Add these lines at the top
# add debounce component
loadrt debounce cfg=3
# set delay (number of iterations of base thread )
setp debounce.0.delay 200


# add debounce to thread
addf debounce.0 base-thread



Replace the these three lines
net both-home-x <= parport.0.pin-10-in
net both-home-y <= parport.0.pin-11-in
net min-home-z <= parport.0.pin-12-in

Replace with this
net debounce-home-x debounce.0.0.in <= parport.0.pin-10-in
net both-home-x debounce.0.0.out
net debounce-home-y debounce.0.1.in <= parport.0.pin-11-in
net both-home-y debounce.0.1.out
net debounce-home-z debounce.0.2.in <= parport.0.pin-12-in
net min-home-z debounce.0.2.out


I hope this helps someone else.
Brendan
The following user(s) said Thank You: andypugh

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

More
07 Mar 2021 04:05 #201259 by phillc54
Replied by phillc54 on topic Debounce
If you use 2.8 or later it is worth considering the dbounce component which allows naming

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

Time to create page: 0.074 seconds
Powered by Kunena Forum