LK202-24-USB rev 1
18
3.3 USB 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.
3.4 Keypad Commands
Before issuing commands to the LK202-24-USB please read sections 6.2 and 6.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 5.1.1 for further information.
3.4.1 Auto repeat mode on (254 126 [mode]) (R)
[mode] = 0x00 gives Resend Key Code mode
[mode] = 0x01 gives Key down / Key up code mode
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. In this mode, when a key
is held down, the key code is transmitted 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 is 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.
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 20 hex. For example, the key code associated with key 'P' (0x50)
is pressed, the release code is 'p' (0x70).
In RS-232 polled mode (see 3.4.4 below) or via the I²C interface, the key down / key up codes are
used; however, the user should be careful of timing details. If the poll rate is slower than the simulated
auto – repeat it is possible that polling for a
key up
code will be delayed long enough for an unwanted
key repeat to be generated (see Figure 3-2).
unwanted auto-repeat
after key-up.
Polls
Key down
Key up
auto-repeat clock
valid key stroke
(before key up)
Figure 3-2 Poll timing
3.4.2 Auto repeat mode off (254 96) (R)
This command turns off auto repeat mode.