Application Example - Filtering Button Signal and Initiating ADC Conversion

Using the signal from a mechanical button directly into an application without any form of filtering will in many cases lead to unpredictable behavior, since the signal often transitions several times between high and low each time the button is pushed or released. This is often referred to as bounce. If an application is required to act once each time a mechanical button is pressed, some form of filtering needs to be implemented either in hardware or software, also referred to as debouncing.

This chapter describes an application example that consistently initiates a single ADC conversion when a mechanical button is pressed, without involving the AVR core or adding external filtering. Debouncing the button signal is accomplished by filtering it with the CCL and using the filtered signal to trigger an ADC conversion. The signals are routed via the Event System, and when the conversion result is ready, the result is transmitted via the USART module for verification.

The figure below shows an overview of how the utilized device modules, the CPU, and the connections between them are configured. For details on how the application is implemented on a specific device or evaluation kit, open and inspect the example application in Atmel START. How to find the application in Atmel START is described in chapter Get Source Code from Atmel | START.

Figure 1. Example Overview