Keyboard, Ppears, Table 6-2 – Digilent 410-044-10P-KIT User Manual
Page 28: Figure 6-2, The clo
28
Spartan-3 Starter Kit Board User Guide
1-800-255-7778
UG130 (v1.1) May 13, 2005
Chapter 6: PS/2 Mouse/Keyboard Port
R
bidirectional keyboard communications. As shown in
Figure 6-2
, the attached keyboard or
mouse writes a bit on the data line when the clock signal is High, and the host reads the
data line when the clock signal is Low.
The following site contains additional information on the PS/2 bus protocol:
•
PS/2 Mouse/Keyboard Protocol
Keyboard
The keyboard uses open-collector drivers so that either the keyboard or the host can drive
the two-wire bus. If the host never sends data to the keyboard, then the host can use simple
input pins.
A PS/2-style keyboard uses scan codes to communicate key press data. Nearly all
keyboards in use today are PS/2 style. Each key has a single, unique scan code that is sent
whenever the corresponding key is pressed. The scan codes for most keys appear in
If the key is pressed and held, the keyboard repeatedly sends the scan code every 100 ms or
so. When a key is released, the keyboard sends a “F0” key-up code, followed by the scan
code of the released key. The keyboard sends the same scan code, regardless if a key has
different “shift” and “non-shift” characters and regardless whether the Shift key is pressed
or not. The host determines which character is intended.
Some keys, called extended keys, send an “E0” ahead of the scan code and furthermore,
they may send more than one scan code. When an extended key is released, a “E0 F0” key-
up code is sent, followed by the scan code.
Table 6-2:
PS/2 Bus Timing
Symbol
Parameter
Min
Max
T
CK
Clock High or Low time
30
µs
50
µs
T
SU
Data-to-clock setup time
5
µs
25
µs
T
HLD
Clock-to-data hold time
5
µs
25
µs
Figure 6-2:
PS/2 Bus Timing Waveforms
T
CK
T
SU
T
HLD
T
CK
Edge 0
Edge 10
CLK (PS2C)
DATA (PS2D)
'0' start bit
'1' stop bit
UG130_c6_02_042404