10
AVR364
8377B-AVR-11/11
6 Miscellaneous I/O
6.1 Mechanical buttons
The board is equipped with three mechanical buttons. The buttons (SW0:2) are
shared with LED0, LED2, and LED3. Onboard protection circuitry is added to avoid a
short when driving the port high at the same time as pushing the button, which will
short it to the ground. To be able to use both button and LED, time multiplexing has to
be used.
To be able to detect a button press, the firmware has to periodically set the I/O pin to
input with pull-up and check if it is low. When doing this fast enough, the human eye
will not see any change in the LED.
6.2 LEDs
The Atmel MEGA-1284P Xplained has four standard yellow LEDs mounted onboard,
which are conneLED0, LED2, and LED3 are shared with the three mechanical buttons (SW0:2). When
turning an LED on, set the I/O pin to output low. When turning an LED off, set the I/O
pin as input with pull-up. The protection circuitry added to the button will make the
LED shine brighter when the button is pressed and the LED is turned on. When the
LED is off, any button press will light up the LED.
The Atmel MEGA-1284P Xplained also has one dual LED mounted near the USB
connector. This is the power and status LED, which is connected to the board
controller. This LED will be green when power is applied, and will toggle between
green and orange when communication over USB is ongoing.
6.3 Analog I/O
An RC filter, a light sensor, and an NTC are connected to ADC5, ADC6, and ADC7,
respectively. These analog sources can be used as input to the ADC. All of the
analog signals can be disconnected by cutting the cut-straps on the bottom side of
the board.
The RC filter (first-order low-pass) has an approximate 3dB cut-off frequency of
159Hz. The input to the RC filter is GPIO5 (PD5) on , which can be
configured to output a PWM signal to the RC filter. This can be used to generate a
DC voltage on the output of the RC filter, which can be measured on the ADC5 pin.
As this is a first-order filter, the ripple on the DC voltage is inversely proportional to
the input frequency. A higher input frequency will result in lower ripple on the output.
6.4 Touch
The MEGA-1284P XPLAINED kit has one Atmel QTouch button, QTB0.
Table 6-1.
MEGA-1284P Xplained touch connections.
Touch sensor onboard
reference
QTouch method pin name
ATmega1284P pin
QTB0 SNSK0
PD7
QTB0 SNS0 PD6