FlexiCoder
TM
K25C81
Versatile PC/XC/AT/PS/2 Compatible
Keyboard Encoder
FlexiCoder
TM
is a trademark of Semtech Corp. All
other trademarks belong to their respective
companies.
Copyright Semtech, 1997-2001
DOC5-C81-DS-105
www.semtech.com
1
HID & SYSTEM MANAGEMENT PRODUCTS, KEYCODER
TM
FAMILY
DESCRIPTION
FEATURES
1
_RESET
40
Vcc
OSCI
OSCO
EKC1
R7
NC
R5
R4
R3
R2
R1
R0
C8
C9
C10
C11
C12
C13
C14
C15
_IRQ
VX
C17
R6
RP
KD
KC
EKC
EKD
C16
C0
C1
C2
C3
C4
C5
C6
C7
Vss
2
39
3
38
4
37
5
36
6
35
7
34
8
33
9
32
10
31
11
30
12
29
13
28
14
27
15
26
16
25
17
24
18
23
19
22
20
21
DIP
R6
C17
VX
NC
_IRQ
_RESET
VCC
OSCI
OSC0
EKC1
NC
RP
KD
KC
EKC
EKD
C16
C0
C1
C2
C3
C4
R7
NC
R5
R4
R3
R2
R1
R0
C8
C9
C10
NC
C5
C6
C7
VSS
NC
C15
C14
C13
C12
C11
40
1
6
7
12
17
18
23
28
29
34
39
R6
RP
KD
KC
EKC
EKD
C16
C0
C1
C2
C3
C17
VX
_IRQ
_RESET
NC
NC
VCC
OSCI
OSCO
EKC1
R7
NC
R5
R4
R3
R2
R1
R0
C8
C9
C10
C11
C4
C5
C6
C7
NC
VSS
C15
C14
C13
C12
NC
1
PLCC
QFP
Custom keyboards/keypads
Control panels
Automatic teller machines
Embedded control systems
Public Information Kiosks
Instrumentation
Test and Measurement equipment
Point of Sales terminals
Industrial Controllers
Medical Instruments
Enables custom keypad scan
codes to remain unaffected by
the Shift States of an external
keyboard
Includes jumper-selectable auto-
repeat for designated keys
Offers two-key inhibit scanning
mode
Directly interfaces a PC
keyboard port
Encodes up to 144 custom keys
on an 8 X 18 matrix
Buffers up to 122 keycodes
Interfaces to 83/101/102
standard keyboard or other
8042-compatible device
The FlexiCoder
TM
is a versatile, low-
power keyboard encoder. It offers
two bi-directional channels for
communicating with a
PC/XT/AT/PS2 system, and/or any
optional keyboard-compatible
devices, such as an 83 or 101/102
standard desktop keyboard, OCR,
barcode reader, etc. The K25C81
directly interfaces a PC keyboard
port, making custom keyboard to
system communications fully
transparent.
On an 8 x 18 matrix, the
FlexiCoder
TM
will scan, debounce
and encode up to 144 keys. Scan
codes corresponding to single keys
of the IBM 101 keyboard, or a
combination of these keys when
depressed with Shift, Ctrl, and Alt
keys, are generated with each key
press. Custom keypad input is not
effected by the Shift States of an
external keyboard.
Users can conveniently define key
assignments on the matrix as single
or repeating actions. All keys must
be released between key strokes or
scanning is suspended. The
encoder can buffer up to 122
keycodes, and control inputs and
outputs are provided for interfacing
with contact keyboards.
The FlexiCoder
TM
is ideal for use
with either BIOS-compatible chip
sets or single-board computers for
PC systems requiring a custom
keyboard / keypad as an alternate
or additional input device. Boards
and evaluation kits are immediately
obtainable and ready to connect.
APPLICATIONS
PIN ASSIGNMENTS
FUNCTIONAL DIAGRAM
ORDERING CODE
Copyright Semtech, 1997-2001
DOC5-C81-DS-105
www.semtech.com
2
Package options
40-pin, Plastic DIP
44-pin, Plastic PLCC
44-pin, Plastic QFP
Pitch In mm's
2.54 mm
1.27 mm
0.8 mm
TA = -40C to +85C
K25C81-XX-P
K25C81-XX-FN
K25C81-XX-FB
Data Buffer
Interrupt Control
PC
Communication
Channel
8042 Emulation
(Standard Keyboard)
Communication Channel
EKC1
KC
KD
EKC
EKD
Keyboard Encoder
Mode Control
Row Data Inputs
Column Select Ouputs
R0-R7
RP
C0-C17
8
18
FUNCTIONAL DESCRIPTION
PIN DEFINITIONS
Copyright Semtech, 1997-2001
DOC5-C81-DS-105
www.semtech.com
3
Mnemonic
DIP
PLCC
QFP
TYPE
Name and Function
Vcc
40
44
38
I
Power Supply: +5V
Vss
20
22
17
I
Ground
OSCI
39
43
37
I
Oscilator Input
OSCO
38
42
36
O
Oscilator Output
_RESET
1
1
41
I
Reset: apply 0 V to provide orderly
start-up.
_IRQ
2
2
42
I
Must be tied to Vcc
VX
3
4
43
I
Tie to Vcc.
RP
6
7
2
I
Rollover Mode Selection: tie to
Vcc to select N-Key Rollover. Tie to
Ground to select Two-Key Inhibit
Mode.
KC
8
9
4
I/O
Keyboard Clock: connects to PC's
keyboard port Clock Line.
KD
7
8
3
I/O
Keyboard Data: connects to PC's
keyboard port Data Line.
EKD
10
11
6
I/O
External Keyboard Data:
connects to external keyboard Data
Line.
EKC
9
10
5
I/O
External Keyboard Clock:
connects to external keyboard Clock
Line.
EKC1
37
41
35
I
External Keyboard Clock 2:
connects to external keyboard Clock
Line and is used to generate an
interrupt for every Clock Line transition.
This signal must be inverted for PC/XT
keyboards.
C0-C7
12-19
3-17
8-15
O
Column Select Outputs: select
18
one of columns.
19-21
C8-C15
28-21
31-24
26-18
C16
11
12
7
O
C17
4
5
44
I/O
Keyboard type selection: this pin
is used both as outputs for column
select and as input for standard
keyboard-type selection.
R0-R5
29-34
32-37
27-32
I
Row data inputs
R6
5
6
1
I
R7
36
39
34
I
NC
35
38, 3
16, 33
-
No Connects: these pins are
18, 23
22, 39
-
unused.
40
40
Note: An underscore before a pin mnemonic denotes an active low signal.
The FlexiCoder
TM
consists of six
major sections (see functional
diagram, previous page). These
are the Keyboard Encoder, the
Mode Control Unit, the PC
Communication Channel, the 8042
Emulation Channel, the Interrupt
Control Unit and the Data Buffer.
These sections communicate with
each other and operate
concurrently.
The controller continuously scans a
keyboard organized as an 8 row by
18 column matrix, for a maximum of
144 keys. Smaller-size keyboards
can be connected provided that all
unused row pins are connected to
Vcc. The microcontroller selects
one of the 18 column lines (C0-C17)
every 512 S 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 approxi-
mately 9.2 mS. Each key press 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 Keyboard Communication
Channel.
REPEAT KEYS
FUNCTIONAL DESCRIPTION, (CON'T)
Copyright Semtech, 1997-2001
DOC5-C81-DS-105
www.semtech.com
4
In custom masks, each key can be
defined individually to be either
Typematic or Single-Touch Action.
In the standard mask, all keys are
defined to be Single-Touch Action,
except the Arrow Keys. Pin RP
controls the repeat action of keys
that are defined to be Typematic.
Table 1: Typematic Action Control
The Typematic rate can be
controlled by issuing the
appropriate commands from the
system.
Repeat Mode
RP
No repeat action
L
Repeat action
H
Switch Matrix Encoding
Each matrix location is programmed to represent either a single key or a
combination of keys of the IBM-standard 101/102 keyboard.
Scan Code Table Sets
The FlexiCoder
TM
supports two scan code table sets. Scan Code Sets 1 and
2 are the default sets for PC/XT and AT/PS/2 systems respectively. For
more information, refer to the IBM Technical Reference Manual. Custom
scan code tables, including macros, are also available. Operating modes
are defined by the logic level of the relevant mode pins in the Mode Control
Unit.
Scan Matrix Data Integrity
The FlexiCoder
TM
maintains the integrity of the codes corresponding to the
scanned matrix locations, independently of the Shift Status of the external
keyboard or the system. For example, if a key has been defined on the
matrix to send code corresponding to lower case letter "a", it will still send
the scan code for "a" even if the Shift Key has been pressed or the Caps
Lock has been set by the external keyboard. This is accomplished by
internally maintaining a set of flags to monitor the Shift Status of the external
keyboard and the system. If, for instance, the lower case key "a" is found to
be pressed and Caps Lock is set, the codes sent will be as follows:
1. Caps Lock Make Code
2. Caps Lock Break (this will reset the Caps Lock status of the system)
3. "a" Make Code
4. "a" Break Code
5. Lock Make Code
6. Caps Lock Break Code (this will restore the Caps Lock status of the
system)
SPECIAL HANDLING
SPECIAL HANDLING, (CON'T)
External Keyboard Connection
If an external keyboard was not
connected during power-on and
then connected at a later time, the
controller will proceed with the
normal reset routine in order to
initialize the external keyboard
properly. Thereafter, the
FlexiCoder
TM
checks for the
presence of an external keyboard
every 2 seconds. After
communication has been
established, the controller continues
checking for the external
keyboard's presence. Should the
external keyboard be removed at a
later time, the K25C81 detects the
disconnection and will reinitiate the
reset sequence upon reconnection.
This feature allows the user to
connect and disconnect an external
keyboard at any time without
resetting the system.
EXT. KBD COMMUNICATION
MODE CONTROL
Copyright Semtech, 1997-2001
DOC5-C81-DS-105
www.semtech.com
5
The external keyboard
communication port of the
FlexiCoder
TM
fully emulates a
standard 8042, available to an
83/101/102 external keyboard or
other compatible device.
Communication with an external
keyboard is accomplished via EKC
and EKD, Clock and Data lines
respectively. A third pin, EKC1
which connects to the Clock Line,
interrupts the controller whenever
an external keyboard initiates a
communication.
When power is first applied, the
controller proceeds with the
standard reset sequence with the
external keyboard. Data and
commands coming from the
external keyboard are buffered in
the controller's FIFO, along with
data from the scanned matrix, and
then presented to the system as if
originating from a single source.
Commands and data from the
system, after being acknowledged,
are then transmitted to the external
keyboard.
The FlexiCoder
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 according to the
protocol (PC or AT) selected. In
addition, the K25C81 supports
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 value in
hex.
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)
These commands are supported in
the AT/PS/2 protocol and can be
sent to the keyboard at any time.
Mode 1 accepts only the `reset'
command. Commands shown in
italics do not affect the operation of
the K25C81. Nevertheless, they
are acknowledged and relayed to
the external keyboard, if an
external standard keyboard is
present.
The following table shows the
commands that the keyboard may
send to the system.
Command
Hex Value
Key Detection
00*
Error/Overrun
Keyboard ID
83AB
BAT Completion Code
AA
BAT Failure Code
FC
Echo
EE
Acknowledge (Ack)
FA
Resend
FE
Key Detection
Error/Overrun
FF*
*Scan Code Set 2
Table 3: Keyboard Commands to the
System (AT/PS/2 protocol)
When an external keyboard is
connected, commands from the
system will also be directed to the
external keyboard. Presence or
absence of an external keyboard
will not affect the normal operation
of the FlexiCoder
TM
.