??? 06/11/08 13:52 Read: times |
#155714 - IF you choose the right rate ... and IF you check Responding to: ???'s previous message |
There's nothing unreasonable about the approach you've taken, nor is there any reason you can't find a compromise between the rate at which you sample the switches and the characteristics of the momentary switches you've chosen. A quick look with an oscilloscope will tell you how long the switch bounces and it will also tell you about the ambient noise's effect on signal level. Once you know how long the bounce is and how much energy there is in the noise, you can choose capacitors and resistors to mitigate those effects.
Most modern momentary switches are built to minimize the bounce. They still bounce, and that will affect the current flow through them, but, generally speaking, their construction minimizes the time that they vacillate between fully open and fully closed. This affects primarily the open sequence but it does minimize the bounce on close. As a result, you can help yourself by using relatively small cap's and large resistance. If your pullup + series resistor lie in the range between 3K and 10K ohms, the rise and fall time of the inputs to the PISO register should still be short enough that the CMOS parts will be satisfied. It's only if the ambient noise has so much energy that it causes them to reach Vih occasionally despite the switch closure to GND, that you run the risk of misreading a bit. RE |