DeskCoder
TM
UR5HC418
AT / PS/2 - Compatible
Keyboard Encoder
HID & SYSTEM MANAGEMENT PRODUCTS, KEYCODER
TM
FAMILY
DESCRIPTION
The DeskCoder
TM
keyboard encoder
functions as a versatile, low-power
desktop keyboard encoder, while
providing two bi-directional
channels for communication with a
BIOS-compatible system as well as
any optional keyboard-compatible
devices, such as a 101/102/104
desktop keyboard, OCR, barcode
reader, etc.
The DeskCoder
TM
fully supports the
IBM standard keyboard communi-
cation protocol; each key press
generates one of the scan codes
designated in the IBM Technical
Reference Manuals. The keyboard
encoder handles the scanning,
debounce, and encoding of 128
keys organized on an 8 x 16 matrix.
In addition to the system’s keyboard
communication port, the UR5HC418
provides a fully functional keyboard
input port that can be used by a
standard 101/102/104 keyboard or
another 8042-compatible device,
such as an external numeric
keypad, an OCR, or a bar-code
reader. Input from both the matrix
and the external device is
multiplexed and presented to the
system as if it were coming from a
single source.
The DeskCoder is ideal for use in
low-power, low-cost and high-
reliability AT / PS/2 - compatible
keyboard designs.
TM
FEATURES
• Interfaces contact switch matrix
keyboards to a BIOS-compatible
system
• Single IC desktop keyboard
encoder
• Provides interface for an external
keyboard/keypad or other 8042-
compatible devices
• AT / PS/2 - compatible
APPLICATIONS
• Desktop computers
• Instrumentation
• Industrial keyboards
PIN ASSIGNMENTS
• Point of sales terminals
• Public information kiosks
• Implements all functions of a
101/102/104 keyboard
• Low-power HCMOS
microcontroller, suitable for 3-volt
battery-operated systems
• Available in DIP, PLCC and QFP
packages
• Custom versions available in small
or large quantities
6
RP
KD
KC
EKC
EKD
CL
C0
C1
C2
C3
C4
7
1
R6
NL
VX
VXA
_IRQ
_RESET
VCC
OSCI
OSC0
EKC1
R7A
40
39
_RESET
_IRQ
VX
NL
R6
RP
KD
KC
EKC
EKD
CL
C0
C1
C2
C3
C4
C5
C6
C7
VSS/GND
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
VCC
OSCI
OSCO
EKC1
R7
SL
R5
R4
R3
R2
R1
R0
C8
C9
C10
C11
C12
C13
C14
C15
12
PLCC
34
17
18
23
29
28
R7
SL
R5
R4
R3
R2
R1
R0
C8
C9
C10
DIP
NL
VX
_IRQ
_RESET
NC
NC
VCC
OSCI
OSCO
EKC1
R7
C4A
C5
C6
C7
VSS/GND
NC
C15
C14
C13
C12
C11
Note: A version of the IC that
supports the PC/XT protocol is also
available. Contact Semtech for
more information.
R6
RP
KD
KC
EKC
EKD
CL
C0
C1
C2
C3
1
QFP
NL
R5
R4
R3
R2
R1
R0
C8
C9
C10
C11
DeskCoder and KeyCoder are trademarks of
Semtech Corporation. All other trademarks
belong to their respective companies.
Copyright ©1997-2001 Semtech Corporation
DOC5-418-DS-109
1
www.semtech.com
C4
C5
C6
C7
NC
VSS/GND
C15
C14
C13
C12
NC
ORDERING CODE
Package options
40-pin, Plastic DIP
44-pin, Plastic PLCC
44-pin, Plastic QFP
Pitch in mm’s
2.54
1.27
0.8
TA = -40°C to +85°C
UR5HC418-P
UR5HC418-FN
UR5HC418-FB
FUNCTIONAL DIAGRAM
NL/CL/SL
3
Data Buffer
Status LEDs
Row Data Inputs
EKC1
Interrupt Control
Column Select
Ouputs
16
8
R0-R7
C0-C15
Keyboard Encoder
KC
KD
PC
Communication
Channel
16-Bit Timer
Mode Control
8042 Emulation
(External Keyboard)
Communication
Channel
EKC
EKD
KT
DRV
Copyright ©1997-2001 Semtech Corporation
DOC5-418-DS-109
2
www.semtech.com
FUNCTIONAL DESCRIPTION
The DeskCoder
TM
consists
functionally of seven major sections
shown in the functional diagram on
the previous page: the keyboard
encoder, a 16-bit timer, the mode
control unit, the data buffer, the
interrupt control, the PC commun-
ication channel and the 8042
emulation channel. All sections
communicate with each other and
operate concurrently.
KEYBOARD ENCODER
The controller continuously scans a
keyboard organized as an 8 row by
16 column matrix for a maximum of
128 keys. Smaller-size keyboards
are supported provided that all
unused row lines are pulled to Vcc.
The controller selects one of the 16
column lines (C0-C15) every 512
microseconds and then reads the
row data lines (R0-R7). A key
closure is detected as a zero in the
corresponding position of the
matrix.
A complete scan cycle for the entire
keyboard takes approximately 9.2
mS. Each key found pressed is
debounced for a period of 20 mS.
Once the key is verified, the
corresponding key code(s) are
loaded into the transmit buffer of the
PC communication channel.
PIN DEFINITIONS
Mnemonic
VCC
VSS (GND)
OSCI
OSCO
_RESET
EKC1
DIP PLCC
40
44
20
22
39
43
38
42
1
1
37
41
QFP
38
17
37
36
41
35
Type
I
I
I
O
I
I
Name and Function
Power Supply:
+5V
Ground
Oscillator input
Oscillator output
Reset:
apply 0V to provide orderly start-up
External Keyboard Clock 1:connects
to external keyboard clock line and is used
to generate an interrupt for every clock line
transmission
Tie to VCC
Tie to VCC
Tie to VCC
Keyboard Clock:
connects to
PC keyboard port clock data line
Keyboard Data:
connects to PC port
data line
External Keyboard Data:
connect to
external keyboard data line
External Keyboard Clock:
connects
to external keyboard clock line
Interrupt Line:
reserved for low power
applications
Row Data Inputs
VX
VXA
RP
KC
KD
EKD
EKC
_IRQ
R0-R5
R6
R7
R7A
C0-C4
C5-C7
C8-C15
C4A
CL
NL
SL
NC
3
6
8
7
10
9
2
29-34
5
36
12-16
17-19
28-21
4
3
7
9
8
11
10
2
32-37
6
39
40
13-17
19-21
31-24
18
12
5
38
23
43
2
4
3
6
5
42
27-32
1
34
8-12
13-15
26-23
21-18
7
44
33
39-40
16, 22
I
I
I
I/O
I/O
I/O
I/O
I/O
I
I
I
I
O
O
O
O
O
O
O
O
Column Select Outputs:
select one of
16 columns
11
4
35
Caps Lock LED
Num Lock LED
Scroll Lock LED
No Connects:
these pins are unused
Note:
An underscore before a pin mnemonic denotes an active low signal.
KEYBOARD ENCODER, (CON’T)
Status LED indicators
The controller provides an interface
for three LED shift status indicators.
All three pins are active low to
indicate the status of the host
system (Num Lock, Caps Lock and
Scroll Lock) and are set by the
system.
Scan Code Table Sets
The UR5HC418 supports all three scan code table sets. Scan code table
set 3 allows the user to program individual key attributes such as
make/break and Typematic or single-touch action. For more information,
refer to the IBM Technical Reference Manuals. Custom scan code tables,
including macros, are also available.
Switch Matrix Encoding
Each matrix location is programmed to represent either a single key or a
key combination of the IBM 101/102/104 standard keyboard.
Copyright ©1997-2001 Semtech Corporation
DOC5-418-DS-109
3
www.semtech.com
SPECIAL HANDLING
MODE CONTROL
Connection of External
Device
The DeskCoder
TM
detects the
presence of an external device. If
an external keyboard or other
device is not connected at power-on
and is connected at a later time, the
encoder proceeds with the normal
reset routine in order to properly
initialize the external device. After
communication has been
established, the encoder continues
to check for the presence of the
external device. If the device is
disconnected at a later time, the
encoder becomes aware of it. If a
subsequent connection takes place,
the controller re-initiates a reset
sequence. This unique feature
allows the user to connect or
disconnect an external device at
any time without having to reset the
system.
N-Key Rollover
In this mode, the code(s) corresponding to each key press are transmitted
to the host system as soon as that key is debounced, independently of the
release of other keys.
If a key is defined to be Typematic, the corresponding make code(s) are
transmitted while the key is held pressed. When a key is released, the
corresponding break code(s) are then transmitted to the host system. If the
released key happens to be the most recently pressed, then Typematic
action is terminated. There is no limitation in the number of keys that can
be held pressed at the same time. However, two or more key closures,
occurring within a time interval less than five mS, set an error flag and are
not processed. This procedure protects against effects of accidental key
presses.
“Ghost” Keys
In any scanned contact switch matrix, whenever three keys defining a
rectangle on the switch matrix are pressed at the same time, a fourth key
positioned on the fourth corner of the rectangle is sensed as being
pressed. This is known as the “ghost” or “phantom” key problem. Although
the problem cannot be totally eliminated without using external hardware,
there are methods to neutralize its negative effects for most practical
applications. Keys that are intended to be used in combinations or are
likely to be pressed at the same time by a fast typist (i.e., keys located in
adjacent positions on the keyboard) should be placed in the same row or
column of the matrix whenever possible. Shift Keys (Shift, Alt, Ctrl) should
not reside in the same row (or column) with any other keys.
The DeskCoder
TM
has built-in
mechanisms to detect the presence of
a “ghost” key, thus eliminating the
necessity of external hardware.
Actual key presses
Shift Status LEDs
Shift Status LEDs (Num Lock, Caps
Lock and Scroll Lock) indicate the
status of the system and are
controlled by commands sent from
the system. Set/Reset Status
Indicator Commands from the
system will be executed both by the
external keyboard and the scanned
matrix.
For example, if the user presses the
Caps Lock Key on either keyboard,
the Caps Lock LED will be effected
on both keyboards. The LED status
indicators are properly set after
each new connection of an external
keyboard.
“Ghost”
Key
Figure 1:
“Ghost” or “Phantom” Key
Problem
Copyright ©1997-2001 Semtech Corporation
DOC5-418-DS-109
4
www.semtech.com
8042 EMULATION CHANNEL
The DeskCoder
TM
fully emulates a
system’s keyboard port, available to
a standard 84/85/101/102 external
keyboard or other 8042-compatible
device. Communication with a
keyboard-compatible device is
accomplished by clock and data
lines via EKC and EKD pins,
respectively. A third pin, EKC1 that
connects to the clock line, interrupts
the controller whenever the external
device initiates a communication
session. When power is first
applied, the controller proceeds
with the standard reset sequence
with the external device. Data and
commands initiated from the
external device are buffered in the
controller’s FIFO along with data
from the scanned matrix, and then
are presented to the system as if
they were coming from a single
source. Once they are
acknowledged, commands and
data from the system are then
transmitted to the external device.
PC COMMUNICATION
The DeskCoder
TM
implements all
the standard functions of
communication with a BIOS-
compatible PC/XT or AT/PS/2 host
system. Two lines, KC and KD,
provide bi-directional clock and
data signals. In addition, the
DeskCoder
TM
supports all
commands from and to the system,
as described in the IBM Technical
Reference Manuals.
The following table shows the
commands that the system may
send and their values in
hexadecimal.
Command
Hex Value
Set/Reset Status
ED
Indicators
Echo
EE
Invalid Command
EF
Select Alternate
F0
Scan Codes
Invalid Command
F1
Read ID
F2
Set Typematic
F3
Rate/Delay
Enable
F4
Default Disable
F5
Set Default
F6
Set All Keys
Typematic
F7
Make/Break
F8
Make
F9
Typematic/Make/Break
FA
Set Key Type
Typematic
FB
Make/Break
FC
Make
FD
Resend
FE
Reset
FF
Table 2:
Keyboard Commands from the
System (AT / PS/2 protocol)
The following table shows the
commands that the keyboard may
send to the system.
Command
Key Detection
Error/Overrun
Keyboard ID
BAT Completion Code
BAT Failure Code
Echo
Acknowledge (Ack)
Resend
Key Detection
Error/Overrun
Hex Value
00*
83AB
AA
FC
EE
FA
FE
FF**
*Code Sets 2 and 3
**Code Set 1
Table 3:
Keyboard Commands to the
System (AT/PS/2 protocol)
When an external keyboard is
connected, commands from the
system are also directed to the
external keyboard. Presence or
absence of an external device does
not affect the normal operation of
the UR5HC418.
These commands are supported in
the AT / PS/2 protocol and can be
sent to the keyboard at any time.
Copyright ©1997-2001 Semtech Corporation
DOC5-418-DS-109
5
www.semtech.com