Quote:
Originally Posted by Phalanx
If you want to avoid using interrupts, you could place Kevin Sevcik's code sample in Process_Data_From_Local_IO() within user_routines_fast(). It may give you more accurate readings if you really need that.
I've never had any issue with any mechanical switch generating spurious interrupts, but that has only been my experience. I find with higher quality components that becomes less an issue.
|
Mechanical switches are pretty notorious for bouncing, but typically under light switching force, so the contacts only slowly make contact and the resistance of the connection fluctuates a bit. You can account for this with some debounce logic in the fast loop as well, by checking to make sure the last two or three samples of the input are the same.