L3 Systems KB232 User manual

Copyright 2003
L3 Systems, Inc.
Redmond
KB232
PS/2 Keyboard
RS-232 Adapter
Part # SA0008
(Version 3.0)

Quick Reference
Command Notes
C
Displays
Configuration
String
Field 1 = Terminal emulation:
Simple.TTY, PC. ANSI, or VT
Field 2 = Baud Rate
9600, 4800,2400, or 1200. 9600 is default
Field 3 = Parity
Even, E8,Odd. O8 or No Par (default)
Field 4 = Keyboard LED Settings
1st: “n” =OFF/enabled
“N” = Num ON/enabled. “D” = Disabled
2nd: “c” = Caps OFF/enabled
“C” = Caps ON/enabled. “D” = Disabled
Field 5 = Repeat Delay
0= 250 Milliseconds,1=500, 2=750, 3=1000
Default = 2(750 milliseconds)
Field 6 = Repeat rate (00 to31)
0= 2/sec 31=30/sec, Default is 20 (15/sec)
CW=<string> Write Configuration String
DSet Configuration string to default:
“Simple,9600,No Par,Leds,2,20”
Lkk=aa,bb… Loads custom key code for “aa” as ASCII
hex values aa,bb…
PPrint Custom Key Codes
EErase Custom Scan Codes
HDisplays Help Message
VDisplays Version
TTest Keyboard Interface

L3 Systems 15/19/2007
Introduction
The KB232 PS/2 Keyboard RS-232 adapter allows a
PS/2 style keyboard to be connected to an RS-232
port of a computer or other equipment using RS-
232 communications. This allows the use of a
standard “PC” type keyboard for embedded
applications that only have RS-232 interfaces.
Power considerations
The KB232 receives power from the RS-232 inputs
“DTR” on pin 4 and “CTS” on pin 7 of the DB9-S RS-
232 connector. Typically there is enough power
from the RS-232 signals to allow the keyboard to
operate. However, the Caps Lock and Num Lock
LED’s may require more power than the RS-232
port can provide. If this is the case there are three
possible solutions:
The first solution is to use the “CW=” command to
change the KB232 configuration to not turn on
LED’s and thus saving power. (See pages 5 and 6 for
more information on setting configuration values.)
Some keyboards can operate if one LED is active,
but not two. The “CW=” command allows you to
disable both the Caps Lock and Num Lock LED’s or

KB232 PS/2 Keyboard RS-232 Adapter
5/19/2007 2L3 Systems
just one of them. Notethat if you disable a Caps
Lock or Num Lock LED, the key still will operate to
modify the characters sent.
The second solution is to use a 9 Volt or 12 Volt DC
power supply to power the keyboard and adapter.
You can attach +9V or +12V power supply by
connecting the plus voltage to pin 7, and ground (or
Return) to pin 5 of the RS-232 connector. (Caution:
make sure that the DC positive voltage (pin 7)is
not connected to pin 7 of the RS-232 port of the
equipment to which you are connecting.)
The third solution is to use a keyboard that uses
less power. L3 Systems sells a keyboard which will
work on many RS-232 connections. This is
available with the KB232 RS-232 Keyboard kit.

KB232 PS/2 Keyboard RS-232 Adapter
L3 Systems 35/19/2007
Connections
KB232 RS-232 Serial Port Connector
The KB232 adapter uses a standard RS-232 9-Pin
female “D” connector that can connect directly to a
“PC” computer’s serial port. The KB232 can power
itself and the attached keyboard using active DTR and
CTS signals on pins 4 and 7 of the connector.
However, those signals may not provide adequate
power, in which case +9VDC or +12VDC power may
have to be providedon one of those pins in place of the
DTR or CTS signals.

KB232 PS/2 Keyboard RS-232 Adapter
5/19/2007 4L3 Systems
Pin
Signal KB232 Function
1
Chassis Gnd
2
RX (Receive) from
KB232 RS-232 Output
3
TX (Transmit) to
KB232 RS-232 Input
4
DTR or 9-12V DC
Power RS-232 Input (Used
to power the KB232
Adapter)
5
Signal Ground Ground
7
CTS or 9-12V DC
Power RS-232 Input (Used
to power the KB232
Adapter)

KB232 PS/2 Keyboard RS-232 Adapter
L3 Systems 55/19/2007
KB232 Mini-DIN Connector
The following connector shows the pin
definitions for the KB232 Female 6-Pin Min-
DIN connector and the mating keyboard Male
6-Pin Mini-DIN Connector.
12
3 4
56
1
234
5
6

KB232 PS/2 Keyboard RS-232 Adapter
5/19/2007 6L3 Systems
Testing the RS-232 Communications
The KB232 RS-232 Keyboard Adapter comes setup
with RS-232 communications of 9600 baud, 8 data
bits, 1 stop bit and no parity. This can be changed, but
the first time you talk to the KB232 you must use this
setting.
To verify the KB232 interface, we suggest using a
serial terminal program such a Tera Term, Kermit,
Hyperterm, Procomm, etc. After setting the
appropriate baud rate and bit frame, each time you
type an <ENTER> key should elicit a “:” response:
:<ENTER>
:
Testing Keyboard Operation
If you have verified the RS-232 communications, you
should be able to type on the attached keyboard and
see characters. Type the keys “A” “B: and “C” on
keyboard and you should see the corresponding lower-
case letters echoed:
:abc

KB232 PS/2 Keyboard RS-232 Adapter
L3 Systems 75/19/2007
Commands
The KB232 Adapter comes with a small set of
commands that can be sent through the RS-232 port
to configure operation. Typing “H<Enter>” on the RS-
232 terminal will list the commands that can be
entered:
:h<Enter>
Commands
--------
C-Show Config String
C<string>-Load Config <String>
D-Set Default Config
E-Erase Custom Scan Codes
H-Help Screen
Lkk=aa,bb... Load scan code
P-Print Custom Scan Codes
T-Keyboard Test
V-Version
:

KB232 PS/2 Keyboard RS-232 Adapter
5/19/2007 8L3 Systems
“C” Configuration Command
The “C” configuration command allows you to display
configuration settings. Just typing “C<Enter>” on the
RS-232 terminal will display the configuration string.
Below is the “C” command showing the configuration
string as shipped with a new KB232 adapter:
:C<Enter>
Simple,9600,No Par,nc,2,20
:
The configuration string is in the following format:
<Emulation><Baud><Parity><LEDs><Repeat Delay><Repeat Rate>
Emulation –Terminal emulation setting:
“Simple“–Simple keyboard, no arrows, function or
special keys such as Home, End, PgUp, PgDn.
(default)
“TTY“–ASCII keyboard, ASCII arrows, but no function
keys or special keys such as Home, End, PgUp,
PgDn.
“PC“–PC Terminal with arrows, function & special keys
“ANSI“–ANSI Terminal, with arrows, function & special
keys
“VT“–VT220/320 Terminal, w/ arrows, function &
special keys. Note: Only first character (underlined)
needed

KB232 PS/2 Keyboard RS-232 Adapter
L3 Systems 95/19/2007
Baud Rate –Valid values are “9600” (default), “4800”,
“2400” and “1200”.(Only two digits needed).
Parity –Valid values are:
“NoPar” –No parity, 8 bit data (default)
“Even” –Even parity, 7 bit data
“E8” –Even parity, 8 bit data
“Odd”–Odd parity, 7 bit data
“O8”–Odd parity, 8 bit data (1st character is the letter O)
LEDs –Keyboard LED indicator operation.
1st character:
“n” –Num Lock LED enabled, initially off (default)
“N” –Num Lock LED enabled, initially on
“D” –Num Lock LED disabled
2nd character:
“c” –Caps Lock LED enabled, initially off (default)
“C” –Caps Lock LED enabled, initially on
“D” –Caps Lock LED disabled
Repeat Delay –Delay before a key repeats
“0”–250ms, “1”–500ms, “2”–750ms, “3”–1000ms.
Repeat Rate –Keyboard key repeat rate. Valid values
are from “00” (slowest, 2/second) to “31”(fastest,
30/second).
Note: The Belkin keyboard provided with the KB232
RS=232 keyboard kit can adjust the repeat rate
by holding down the “Turbo” key and the
pressing the keys F1(slowest) to F7(fastest).

KB232 PS/2 Keyboard RS-232 Adapter
5/19/2007 10 L3 Systems
“CW” Configuration Write Command
You can use the “C” configuration command to set
options described on the previous page. To do this you
type the C command with a string that has
parameters in the same order as displayed:
CW=<Emulation><Baud><Parity><LEDs><Repeat
Delay><Repeat Rate>
Below is an example loading the same values as the
default settings with the minimum characters::
:CW=S,96,n,nc,2,20<Enter>
:
You can then display the string loaded:
:C<Enter>
S,96,n,nc,2,20
:
“D” Set Default Configuration values
The “D” command sets the configuration values to the
default settings:
:D<Enter>
:
You can then display the default configuration string:
:C<Enter>
Simple,9600,No Par,Leds,2,20
:

KB232 PS/2 Keyboard RS-232 Adapter
L3 Systems 11 5/19/2007
“V” Display Version
The “V” command displays the version information
of the KB232 program.
:V<ENTER>
KB232, Version 3.0x0, [C] L3 Systems, Inc. 2003
:
“L” Load Key Code Table
The “L” command allows you to specify what
ASCII characters are sent when a key is struck. The
format of the command is:
Lkk=aa,bb,cc…
The easiest way to explain this command is by an
example. For this example we’ll make the F1 key send
“Hello”. First you need to find the key code for the
keyboard key you want to load in the ASCII key table
on pages 15-19. The F1 key is “05”. Then you need to
find the ASCII codes for “Hello” in the ASCII
hexadecimal charton page 20. The ASCII codes for
“Hello”are 48, 65,6C, 6C and 6F. The following
command would add a look-up for the F1 key to the
key code table:
:L05=48,65,6C,6C,6F<Enter>
:

KB232 PS/2 Keyboard RS-232 Adapter
5/19/2007 12 L3 Systems
If the first byte of the ASCII bytes is between 81 and
86, this signifies that modifier key(s) SHIFT, CTRL
and/or ALT are required:
81=SHIFT 82=CTRL 84=ALT 83=SHIFT & CTRL
85=SHIFT & ALT 86=CTRL & ALT
To load the ALT-F2 key to send “Bye”:
:L06=84,42,79,65<Enter>
:
You can also use the LW command to make a key not
send anything. To do this, just don’t put any bytes
after the equal sign. The following example prevents
the Esc key from sending any characters:
:L01=<Enter>
:
“P” Print Key Code Table
The “P” command outputs the custom key code table
loaded with the “L” command. This example shows the
key codes loaded above:
:P<Enter>
KC Bytes
-- ------
05 48 65 6C 6C 6F ßF1 key sends “Hello”
06 84 42 79 65 ßALT-F2 key sends “Bye”
01 00 ßEsc key sends nothing
:

KB232 PS/2 Keyboard RS-232 Adapter
L3 Systems 13 5/19/2007
“E” Erase Key Code Table
“E” Erases the Key Code Table. The following shows
the “E” command followed by “P” command showing
the empty table.
:E<ENTER>
:P<Enter>
KC Bytes
-- ------
:
“T” Test Keyboard
The “T” command runs a test on the keyboard
interface which cycles the LED indicators in a
pattern.It outputs a “.” each it changes the indicator
pattern, and when done says “OK” indicating success,
or “No Keyboard?” if it has a problem.
:T<ENTER>
.......
OK or No Keyboard?
:

KB232 PS/2 Keyboard RS-232 Adapter
5/19/2007 14 L3 Systems
Emulation settings
The “CW” (Configuration Write) command allows you
to specify an emulation setting. Available selections
are commonly usedASCII terminal emulations which
support the non-ASCII keys on the keyboard. The
ASCII key table on the next page shows the ASCII
characters sent for each emulation type: “Simple”,
“TTY”, “PC”, “ANSI” and “VT”. If these emulations don’t
exactly match your needs, pick the one that comes
closest and then use the LW command to map or re-
map the keys to be what you need.

KB232 PS/2 Keyboard RS-232 Adapter
L3 Systems 15 5/19/2007
ASCII Key Table NN/SS NN=non-shifted, SS=Shifted
Key Emulation: Hex ASCII Characters sent
Code KEY Simple TTY PC ANSI VT
66 BS 08 08 08 08 08
0D Tab 09 09 09 09 09
5A Enter 0D 0D 0D 0D 0D
76 ESC 1B 1B 1B 1B 1B
29 Space 20 20 20 20 20
52 ' / " 27/22 27/22 27/22 27/22 27/22
41 , / < 2C/3C 2C/3C 2C/3C 2C/3C 2C/3C
4E -/ _ 2D/5F 2D/5F 2D/5F 2D/5F 2D/5F
49 . / > 2E/3E 2E/3E 2E/3E 2E/3E 2E/3E
4A / / ? 2F/3F 2F/3F 2F/3F 2F/3F 2F/3F
45 0 / ) 30/29 30/29 30/29 30/29 30/29
16 1 / ! 31/21 31/21 31/21 31/21 31/21
1E 2 / @
32/40 32/40 32/40 32/40 32/40
26 3 / # 33/23 33/23 33/23 33/23 33/23
25 4 / $ 34/24 34/24 34/24 34/24 34/24
2E 5 / % 35/25 35/25 35/25 35/25 35/25
36 6 / ^ 36/5E 36/5E 36/5E 36/5E 36/5E
3D 7 / & 37/26 37/26 37/26 37/26 37/26
3E 8 / * 38/2A 38/2A 38/2A 38/2A 38/2A
46 9 / ( 39/28 39/28 39/28 39/28 39/28
4C ; / : 3B/3A 3B/3A 3B/3A 3B/3A 3B/3A
55 = / + 3D/2B 3D/2B 3D/2B 3D/2B 3D/2B

KB232 PS/2 Keyboard RS-232 Adapter
5/19/2007 16 L3 Systems
ASCII Key Table (cont) NN/SS NN=non-shifted, SS=Shifted
Key Emulation: Hex ASCII Characters sent
Code KEY
Simple TTY PC ANSI VT
1C A61/41 61/41 61/41 61/41 61/41
32 B62/42 62/42 62/42 62/42 62/42
21 C63/43 63/43 63/43 63/43 63/43
23 D64/44 64/44 64/44 64/44 64/44
24 E65/45 65/45 65/45 65/45 65/45
2B F66/46 66/46 66/46 66/46 66/46
34 G67/47 67/47 67/47 67/47 67/47
33 H68/58 68/58 68/58 68/58 68/58
43 I69/49 69/49 69/49 69/49 69/49
3B J6A/4A 6A/4A 6A/4A 6A/4A 6A/4A
42 K6B/4B 6B/4B 6B/4B 6B/4B 6B/4B
4B L6C/4C 6C/4C 6C/4C 6C/4C 6C/4C
3A M6D/4D 6D/4D 6D/4D 6D/4D 6D/4D
31 N6E/4E 6E/4E 6E/4E 6E/4E 6E/4E
44 O6F/4F 6F/4F 6F/4F 6F/4F 6F/4F
4D P70/50 70/50 70/50 70/50 70/50
15 Q71/51 71/51 71/51 71/51 71/51
2D R72/52 72/52 72/52 72/52 72/52
1B S73/53 73/53 73/53 73/53 73/53
2C T74/54 74/54 74/54 74/54 74/54
3C U75/55 75/55 75/55 75/55 75/55
2A V76/56 76/56 76/56 76/56 76/56
1D W77/57 77/57 77/57 77/57 77/57
22 X78/58 78/58 78/58 78/58 78/58

KB232 PS/2 Keyboard RS-232 Adapter
L3 Systems 17 5/19/2007
ASCII Key Table (cont) NN/SS NN=non-shifted, SS=Shifted
Key Emulation: Hex ASCII Characters sent
Code
KEY
Simple TTY PC ANSI VT
35 Y79/59 79/59 79/59 79/59 79/59
1A Z7A/5A 7A/5A 7A/5A 7A/5A 7A/5A
54 [ / { 5B7B 5B7B 5B7B 5B7B 5B7B
5B ] / } 5D/7D 5D/7D 5D/7D 5D/7D 5D/7D
5D \/ | 5C/7C 5C/7C 5C/7C 5C/7C 5C/7C
0E ` / ~
60/7E 60/7E 60/7E 60/7E 60/7E
05 F1 00 3B 1B 4F
50 1B 5B 31
31 7E
06 F2 00 3C1B 4F
51 1B 5B 31
32 7E
04 F3 00 3D1B 4F
52 1B 5B 31
33 7E
0C F4 00 3E1B 4F
53 1B 5B 31
34 7E
03 F5 00 3F1B 4F
54 1B 5B 31
35 7E
0B F6 00 40 1B 4F
55 1B 5B 31
37 7E
0F F7 00 411B 4F
56 1B 5B 31
38 7E
0A F8 00 421B 4F
57 1B 5B 31
39 7E
01 F9 00 431B 4F
58 1B 5B 32
30 7E

KB232 PS/2 Keyboard RS-232 Adapter
5/19/2007 18 L3 Systems
ASCII Key Table (cont) NN/SS NN=non-shifted, SS=Shifted
Key Emulation: Hex ASCII Characters sent
Code
KEY Simpl
eTTY PC ANSI VT
09 F10 00 44
1B 4F 59
1B 5B 32
31 7E
78 F11 00 85
1B 5B 32
38 7E
07 F12 00 86
1B 5B 32
39 7E
60 Pad 0
30 30 30 30 30
61 Pad 1
31 31 31 31 31
62 Pad 2
32 32 32 32 32
63 Pad 3
33 33 33 33 33
64 Pad 4
34 34 34 34 34
65 Pad 5
35 35 35 35 35
67 Pad 6
36 36 36 36 36
68 Pad 7
37 37 37 37 37
6A Pad 8
38 38 38 38 38
6D Pad 9
39 39 39 39 39
6F Pad / 2F 2F 2F 2F 2F
7C Pad * 2A 2A 2A 2A 2A
7B Pad -2D 2D 2D 2D 2D
79 Pad +
2B 2B 2B 2B 2B
6E Pad .2E 2E 2E 2E 2E
Table of contents
Other L3 Systems Adapter manuals