source: avrstuff/kbd/xtk/doc/signalling.txt@ 39e523d

main
Last change on this file since 39e523d was 39e523d, checked in by Adrien Destugues <pulkomandy@…>, 10 years ago

Update docs now that I have things working.

git-svn-id: svn://pulkomandy.tk/avrstuff@102 c6672c3c-f6b6-47f9-9001-1fd6b12fecbe

  • Property mode set to 100644
File size: 1.8 KB
Line 
1XT keyboard protocol and signalling
2===================================
3
4The keyboard comnmunicates with the PC/XT through a mostly single-direction
5serial link.
6
7Both the data and clock line are open collector. When the system is idle, both
8are floating high. It is unclear wether it's up to the keyboard or PC to have
9pull-up resistors, but it is safe to have both.
10
11When the keyboard wants to send a byte:
12- It waits for the CLK and DAT lines to be high, meaning the PC is ready to
13receive a byte.
14- It sends the byte for the keycode. There is a start bit (DATA=1), followed by
15the 7-bit keycode (LSb first), and the make/break bit (set for release, clear
16for key press).
17
18As the 9th bit is pushed, the PC will force the clock line low until the CPU has
19read the received byte and cleared the receiving register.
20
21Timing is not critical as this is handled on the PC side using a shift register.
22The only limitation is that the clock signal is gated with the CPU clock, and
23should not go faster than 2.3MHz.
24
25The PC stores the data on the falling edge of the clock. It can also reset the
26keyboard by pulling the clock line low for too long (10ms or more). At boot and
27upon reset, the keyboard is supposed to send 0xAA when it is ready to work.
28However, I'm not sure my XT clone BIOS actually checks for that.
29
30It is up to the keyboard to manage the states of the LEDs. At power on, the LEDs
31are off. They are switched by pressing CAPS and NUM locks. It's possible that
32they get out of sync with the caps/num state the computer has. It is also up to
33the keyboard to handle typematic (key repeat) and a keyboard buffer, if needed.
34
35The scancodes are the same as PS/2 keyboards scan code set 1. Unfortunately, a
36lot of keyboards won't support this properly, so we use the default scan code
37set 2 (used by Windows, so it should work everywhere) and translate it back
38using a lookup table.
Note: See TracBrowser for help on using the repository browser.