RM0082
RS_Keyboard controller
Doc ID 018672 Rev 1
811/844
35.2.2 Keyboard
interface
When Keyboard mode is selected, it is possible to read from APB Bus the value of externally
connected keyboard, scanned at programmed rate.
The keyboard may contain up to 81 keys. 18 port pins provide a 9x9 scanning matrix. 9 of
the pins are strobes and nine (9) of the pins are inputs.
The circuitry shall scan the keys at a rate of 10, 20, 40 or 80 msecs, controlled by the
software. Two successive cycles are needed to validate a key. Only one key will be allowed
down in a scan cycle. Every valid key condition will cause the value of the key to be written
to a register and an interrupt shall be set. The key value is coded on eight bit; the lower
nibble refers to the column number (0, 1,2…8) while the higher nibble gives the row number
(0,1,2…8) of the key-pressed.
Control Register bits b3 and b2 determine keyboard scanning rate. Each time the timer
expires, the keyboard is scanned. If only one key down is detected and it is the same key as
on the previous scan, a bit is set in the Status register indicating New Key Data. The code
for the key is written to the Keyboard Value register. Key release is signaled only once.
The keypad encoder initialization is made one time when the application starts (prescaler
load value, keyboard enable, scan rate, keyboard operation mode), and then the software
handles the interrupt line in order to process Keyboard interrupt.
35.3 Programming
model
35.3.1 External
signals
Table 728.
External signals
Port pin
GPIO
Keyboard
ROW0
GPIO 0
output kbd(row)0
ROW1
GPIO 1
output kbd(row)1
ROW2
GPIO 2
output kbd(row)2
ROW3
GPIO 3
output kbd(row)3
ROW4
GPIO 4
output kbd(row)4
ROW5
GPIO 5
output kbd(row)5
ROW6
GPIO 6
output kbd(row)6
ROW7
GPIO 7
output kbd(row)7
ROW8
GPIO 8
output kbd(row)8
COLUMN0
GPIO 9
input kbd(column)0
COLUMN1
GPIO 10
input kbd(column)1
COLUMN2
GPIO 11
input kbd(column)2
COLUMN3
GPIO 12
input kbd(column)3
COLUMN4
GPIO 13
input kbd(column)4
COLUMN5
GPIO 14
input kbd(column)5