Atmel Xplained Evaluation Board AT32UC3A3-XPLD AT32UC3A3-XPLD Data Sheet

Product codes
AT32UC3A3-XPLD
Page of 1021
112
32072H–AVR32–10/2012
AT32UC3A3
11.6.6
Keypad scan support
The External Interrupt Controller also includes support for keypad scanning. The keypad scan
feature is compatible with keypads organized as rows and columns, where a row is shorted
against a column when a key is pressed.
The rows should be connected to the external interrupt pins with pull-ups enabled in the I/O Con-
troller. These external interrupts should be enabled as low level or falling edge interrupts. The
columns should be connected to the available scan pins. The I/O Controller must be configured
to let the required scan pins be controlled by the EIC. Unused external interrupt or scan pins can
be left controlled by the I/O Controller or other peripherals.
The Keypad Scan function is enabled by writing SCAN.EN to 1, which starts the keypad scan
counter. The SCAN outputs are tri-stated, except SCAN[0], which is driven to zero. After
2
(SCAN.PRESC+1)
 RC clock cycles this pattern is left shifted, so that SCAN[1] is driven to zero while
the other outputs are tri-stated. This sequence repeats infinitely, wrapping from the most signifi-
cant SCAN pin to SCAN[0].
When a key is pressed, the pulled-up row is driven to zero by the column, and an external inter-
rupt triggers. The scanning stops, and the software can then identify the key pressed by the
interrupt status register and the SCAN.PINS value.
The scanning stops whenever there is an active interrupt request from the EIC to the CPU.
When the CPU clears the interrupt flags, scanning resumes.