English
Language : 

CYW20738 Datasheet, PDF (4/42 Pages) Cypress Semiconductor – On-chip support for common keyboard and mouse interfaces eliminates external processor
CYW20738
1. Functional Description
1.1 Keyboard Scanner
The keyboard scanner is designed to autonomously sample keys and store them into buffer registers without the need for the host
microcontroller to intervene. The scanner has the following features:
■ Ability to turn off its clock if no keys pressed.
■ Sequential scanning of up to 160 keys in an 8 x 20 matrix.
■ Programmable number of columns from 1 to 20.
■ Programmable number of rows from 1 to 8.
■ 16-byte key-code buffer (can be augmented by firmware).
■ 128 kHz clock – allows scanning of full 160-key matrix in about 1.2 ms.
■ N-key rollover with selective 2-key lockout if ghost is detected.
■ Keys are buffered until host microcontroller has a chance to read it, or until overflow occurs.
■ Hardware debouncing and noise/glitch filtering.
■ Low-power consumption. Single-digit µA-level sleep current.
1.1.1 Theory of Operation
The key scan block is controlled by a state machine with the following states:
Idle
The state machine begins in the idle state. In this state, all column outputs are driven high. If any key is pressed, a transition occurs
on one of the row inputs. This transition causes the 128 kHz clock to be enabled (if it is not already enabled by another peripheral)
and the state machine to enter the scan state. Also in this state, an 8-bit row-hit register and an 8-bit key-index counter is reset to 0.
Scan
In the scan state, a row counter counts from 0 up to a programmable number of rows minus 1. Once the last row is reached, the row
counter is reset and the column counter is incremented. This cycle repeats until the row and column counters are both at their
respective terminal count values. At that point, the state machine moves into the Scan-End state.
As the keys are being scanned, the key-index counter is incremented. This counter is the value compared to the modifier key codes
stored, or in the key-code buffer if the key is not a modifier key. It can be used by the microprocessor as an index into a lookup table
of usage codes.
Also, as the n-th row is scanned, the row-hit register is ORed with the current 8-bit row input values if the current column contains two
or more row hits. During the scan of any column, if a key is detected at the current row, and the row-hit register indicates that a hit
was detected in that same row on a previous column, then a ghost condition may have occurred, and a bit in the status register is set
to indicate this.
Scan End
This state determines whether any keys were detected while in the scan state. If yes, the state machine returns to the scan state. If
no, the state machine returns to the idle state, and the 128 kHz clock request signal is made inactive.
The microcontroller can poll the key status register.
Document Number: 002-14891 Rev. *C
Page 4 of 42