How to Debounce a Button Input Using Programmable Logic

DigiKey 제공

Programmable logic offers a level of flexibility that is unavailable with traditional discrete logic ICs. Readily available development tools make it easy to take advantage of creating application-specific functions with field programmable gate arrays and complex programmable logic devices.  An example of such a function is that of debouncing a push-button switch input.

Figure 1 below illustrates an effective debouncing logic circuit.  The circuit continuously clocks the button’s logic level into FF1 and subsequently into FF2, resulting in FF1 and FF2 always storing the last two logic levels of the button.  When these two values remain identical for a specified time, then FF3 is enabled, and the stable value is clocked through to the result output.

Diagram of debouncing logic circuit

Figure 1: Debouncing logic circuit.

The XOR gate and N-bit counter accomplish the timing.  If the button’s level changes, the values of FF1 and FF2 differ for a clock cycle, clearing the N-bit counter via the XOR gate.  If the button’s level is unchanging (i.e. if FF1 and FF2 are the same logic level), then the XOR gate releases the counter’s synchronous clear, and the counter begins to count.  The counter continues to increment in this manner until it (1) reaches the specified time and enables the output register, or (2) is interrupted and cleared by the XOR gate because the button’s logic level is not yet stable.

The counter’s size determines the time required to validate the button’s stability.  When the counter increments to the point that its carry out bit is asserted, it disables itself from incrementing further and enables the output register FF3.  The circuit remains in this state until a different button value is clocked into FF1, clearing the counter via the XOR gate. 

 
DigiKey logo

면책 조항: 이 웹 사이트에서 여러 작성자 및/또는 포럼 참가자가 명시한 의견, 생각 및 견해는 DigiKey의 의견, 생각 및 견해 또는 DigiKey의 공식 정책과 관련이 없습니다.

게시자 정보

DigiKey

미네소타주 시프리버폴스에 위치한 DigiKey는 전자 부품의 시제품 제작/설계 및 양산 모두를 위한 세계적인 풀서비스를 제공하는 업체로서 DigiKey 웹사이트를 통해 750개 이상의 유수 제조업체에서 공급하는 600만 개 이상의 제품을 제공합니다.