beautypg.com

C interface, 4 rs-232 interface, 5 keypad commands – Matrix Orbital LK162-12 Legacy User Manual

Page 21

background image

LK162-12 rev 4

21

Columns

1

2

3

4

1

‘A’

41 Hex

‘F’

46 Hex

‘K’

4B Hex

‘P’

50 Hex

2

‘B’

42 Hex

‘G’

47 Hex

‘L’

4C Hex

‘Q’

51 Hex

Rows

3

‘C’

43 Hex

‘H’

48 Hex

‘M’

4D Hex

‘R’

52 Hex

Note: The keypad connector must be wired with columns on one side and rows on the other side of the
center of the connector. If your keypad isn't wired this way you will need to make an adapter or rewire the
connector to meet this requirement.

4

.

3 I

2

C Interface

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. A good reference is also available at

http://www.ping.be/~ping0751/i2cfaq/i2cindex.htm

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).

4.4 RS-232 Interface

By default on any press of a key, the module will immediately send out the key code at the selected baud
rate. This behavior can be modified using commands found in the next section.

4.5 Keypad Commands

Before issuing commands to the LK162-12 please read sections 7.2 and 7.3.

Some commands, marked with an (R), may be "remembered" to set new defaults that will be in effect each
time the unit is powered on. See section 6.1.1 for further information.

4.5.1 Auto repeat mode on (254 126 [mode]) (R)

[mode] = 0x00 gives Resend Key Code mode