Upload
chouba-nabil
View
8.463
Download
8
Embed Size (px)
DESCRIPTION
Ps2 keyboard VHDL design tutorial
Citation preview
Keyboard PS/2
• IBM introduced a new keyboard with desktop computer.– IBM PC/XT Keyboard (1981)– IBM AT Keyboard (1984) – IBM PS/2 Keyboard (1987)
• Modern PS/2 (AT) compatible keyboards: – Any number of keys (usually 101 or 104) – 5-pin or 6-pin connector; adaptor usually included – Bi-directional serial protocol – Only scan code set 2 guaranteed. – Acknowledges all commands; may not act on all of them.
Pinout 6-pin Mini-DIN (PS/2)
Male
Female
6-pin Mini-DIN (PS/2): 1 - Data 2 - Not Implemented 3 - Ground 4 - Vcc (5V DC at 275 mA) 5 - Clock 6 - Not Implemented
Open-collector interface
• Vcc/Ground provide power to the keyboard/mouse
• Vcc = +4.5V to +5.5V • Max Current = 275 mA. • The Data and Clock lines are
both open-collector with pullup resistors to Vcc
Matrix of keys
• keyboard's processor scan the matrix of keys• Send a packet of information the host when :
• Key pressed• released• held down
• information known as a "scan code“• key is associated to code :
• "scan code set" table • Default scan code set for all modern keyboards
Make & Break Codes
Key Make Code Break Code
"A" 1C F0,1C
"5" 2E F0,2E
"F10" 09 F0,09
Right Arrow E0,74 E0,F0,74
Right Ctrl E0,14 E0,F0,14
When a key is pressed, make code is sent to the computer. When a key is released a break code is sent When you press and hold down a key, that key becomes typematic, keep sending that key's make code (0.25sec to 1sec ) until the key is released or another key is pressed. Exp : hold the key “A" down : 1C 1C 1 C . . . 1C FO 1C
Keyboard make code
* no defined relationship between a make code and an ASCII code
Device-to-host communication protocol
• The clock frequency must be in the range 10 - 16.7 kHz. • 1 start bit. This is always 0.
• 8 data bits, least significant bit first.
• 1 parity bit (odd parity).
• 1 stop bit. This is always 1.
• 1 acknowledge bit (host-to-device communication only)
Waveform "Q" key
Scan code for the "Q" key (15h) being sent from a keyboard to the host. Channel A is the Clock signal; channel B is the Data signal.