2 scan and debounce, 3 interrupt generation – Cirrus Logic EP93xx User Manual

Page 767

Advertising
background image

DS785UM1

26-5

Copyright 2007 Cirrus Logic

Keypad Interface

EP93xx User’s Guide

2

6

2

6

26

26.2.2 Scan and Debounce

Products are scanned based on the KEY_SCAN register value. Each complete array scan
starts with ROW7 and then progresses to ROW0, 1, and so on because of the pipelined
nature of the key scan controller. Keys in this ROW have precedence and are considered first
in the scan order because ROW7 is scanned first. When a key is pressed, it may
mechanically bounce for a up to 20 msec. The key array scan circuit will count the number of
consecutive scans that decode to the same 1 or 2 first keys encountered from the start of a
scan.

When a preset scan count limit is reached (counted by the DEBOUNCE_COUNT counter),
the key is considered to be de-bounced and an interrupt will occur. If a scan does not decode
the same 1 or 2 first keys as the previous scan, then the scan count will be reset. The scan
count limit is adjustable from 0 to 255 scans by writing to the DEBOUNCE_COUNT register
in the chip. The register is written with the complement of the desired scan count limit.
Typically a scan count limit of 3 is used.

Key arrays may have significant capacitance. If a key is pressed at a location ROWY, COLX,
the capacitance associated with COLX is discharged when the ROWY line is driven low
during the scan. When ROWY + 1 is driven, the capacitance associated with COLX must
then charge to a logic 1 passively before the COL inputs are sampled. If not, an erroneous
key press will be detected. For fast scan times, the time to charge the key array between
column samples is reduced. To reduce the time to charge the key array, the back drive
feature may be used. When back drive is enabled, the column lines and row lines are all
driven high for a short period of time between ROW scanning time to charge the array
capacitance.

26.2.3 Interrupt Generation

An interrupt is generated whenever the key scanner detects a new stable set of keys. This
means that an interrupt occurs after a key is pressed and then after the key is released. An
interrupt will also occur if the first or second pressed keys in the array change to different
keys. When the interrupt occurs, the number of decoded keys pressed and the array
coordinates of the pressed keys are stored. The interrupt signal is maintained by a flip flop.
The interrupt flip flop is cleared when the key register is read by the ARM Core. The interrupt
condition can also be read by the ARM Core. Interrupt conditions are 1 key, 2 keys, and no
keys.

Assume that the keys may bounce for up to 20 msec and each scan is roughly 8 msec and
the scan count limit is set to 3 then an interrupt will occur between 24 and 44 msec after a key
is pressed or released. If a scan count limit of 0 is set by writing 0xFF to the de-bounce count
pre-load register then an interrupt will only occur the first time a key is pressed. No further
interrupts will occur because the DEBOUNCE_COUNT counter will always be reset to its
terminal count.

If an interrupt is ignored, then a subsequent interrupt will be pending until the first interrupt is
serviced. If further keypad activity occurs after an interrupt is pending then the most recent
de-bounced and decoded event will become pending and the previous pending conditions
will be lost.

Advertising