Matrix Orbital LK202-25 Legacy User Manual
Page 4

The Keypad Interface
Keypad Interface via I²C
The keypad is read by I²C master read. In short, this means that a read of the module will always return the first unread key
press. A read is initiated by writing to the module with its base address plus 1, then clocking the module’s return byte after
the module releases the SDA line. Much more detail on this basic I²C function can be found in the I²C specification by
Philips.
The module contains a ten key press buffer so that it can be polled for key presses at an infrequent rate (every 500 to 1000
mS is typical). All returned key presses indicate the presence or absence of additional logged key presses by the most
significant bit (MSB - bit 7). If the user has pressed two keys since the last poll of the keypad interface, the first read will
return the key code with bit 7 set and the second read will return the key code with bit 7 clear. The application must take
into account this bit to keep up with user key presses. If there are no keypresses detected, the module will return zero
(0x00).
Keypad Interface via RS - 232
By default on any press of a key, the module will immediately send out the key code at the selected baud rate.
Auto Transmit:
If the auto transmit mode is on (default) then on any keypress, the module will immediately send out the key code at the
selected baud rate. If auto transmit is off, when the poll command is sent, the module will immediately send the key code.
Keypad Interface (Both I²C and RS - 232)
Auto Repeat:
Two Modes of auto repeat are available and are set via the same command.
1)Resend Key Code: This mode is similar to the action of a keyboard on a PC and is set via the '~" command with a value
of 0 as outlined in the Command Set section of this manual. In this mode, when a key is held down, the key code is trans-
mitted immediately followed by a 1/2 second delay. After this delay, key codes will be sent via the RS - 232 interface at a
rate of about 5 codes per second. This mode has no effect if polling or if using the I²C interface.
2)Key down / Key up codes: This mode may be used when the typematic parameters of the Resend Key code mode are
unacceptable or if the unit being operated in polled mode. The host system detects the press of a key and simulates an auto
repeat inside the host system until the key release is detected. This mode is entered via the '~' command with a data value
of (0x01). In this mode, when a key is held down, the key code is transmitted immediately and no other codes will be sent
until the key is released. On the release of the key, the key release code transmitted will be a value equal to the key down
code plus 40 hex. The key code associated with key code '0' (0x30) is pressed, the release code is 'p' (0x70). In RS - 232
polled mode or via the I²C interface, theses codes are available in the same manner as keypresses without auto repeat;
however, the user should be careful to ensure that the poll rate is high enough so that simulated key repeats are avoided
after the release of the key but before the next poll.
Physical Layout:
The returned key codes are as follows, but note that your keypad may be laid out in a different pattern. If this is the case, the
user will need to interpret the key codes differently. The diagram 1 shows the logical layout (row 1, column 1 in upper left).
The connector for the keypad is a 10 pin .1" spacing male header. Pin 1 is indicated on the connector layout diagram. Pins 1
through 5 are columns and pins 6 through 10 are row. The keypad is scanned whenever a key is pressed. There is no
continuous key scan. This means that key presses are dealt with immediately without any appreciable latency. This also
prevents electrical noise which is often caused by continuous key scans.
5