Debounce code for push-buttons in project

Go To Last Post
103 posts / 0 new

Pages

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just think of the return value of get_key_press() as if you were making a direct read on PINC or whichever input register you have selected. The only differences are two-fold: one is that rather than ANDing after the read to pick selected bits (as you might with a direct read of PINx) you can pass a mask INTO the function to mask bits beforehand. Also the output is "special" in that unlike a direct read of PINx where you might see bits "flickering" between 0 and 1 the function "smoothes" the output so you only see "solid" 0s and 1s.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, I have already integrated the code in my project. I think it's working just fine!

Pages