Hi,
If it's really not debouncing properly - even with 65ms worth of "debounce time", you've got to have a really bouncy switch... :-)

Are you sure that it's not the autorepeat feature you're seeing? If you change the value 40 in your example to 255 it will still debounce but not autorepeat - according to the manual.

/Henrik.