| ||
6 March 2009 Author: Giorgos Lazaridis The PS2 protocolThe commands The keyboard and the host communicate together using a pre-defined command set, also part of the PS2 protocol. Those commands are detailed analyzed below. The host commands These are the commands that the host will send to the keyboard: 0xED - Write LEDs This command is followed by a byte indicating the desired LEDs setting. Bits 7-3: unused [0] Bit 2: CapsLock LED state. [1]=On [0]=Off. Bit 1: NumLock LED state. [1]=On [0]=Off. Bit 0: ScrollLock LED state. [1]=On [0]=Off. When OK, both bytes are acknowledged. If the second byte is recognized as a command, that command is acknowledged and done instead, otherwise a NACK is returned. 0xEE - Echo This command requests an echo return by the keyboard (again 0xEE). 0xF2 - Read keyboard ID This command reads a 2-byte keyboard ID. XT keyboards do not answer to this command. AT keyboards will reply with an ACK (0xFA) only. The MF2 and other keyboards will reply with a 2 byte ID. A 10msec delay should be considered after this command. 0xF3 - Set repeat rate and delay Following this command is a byte with the desired delay and repeat rate. Bit 7: unused, [0]. Bits 6-5: Delay. [0]=250, [1]=500, [2]=750, [3]=1000msec. The default value after a reset is 500msec Bits 4-0: inter-character delay. To calculate the delay, follow the next formula: Delay= ((2^A)*(8+B))/240 cps (characters per second) where A=Bits 4-3 and B=bits 2-0. By default after reset the delay is 10.9 cps 0xF4 - Keyboard enable The keyboard is automatically disabled after every transmission failure. This command re-enables the keyboard and clears its internal 16-byte buffer. 0xF5 - Set defaults and disable keyboard This command resets the keyboard, clears the output buffer, switch off the LEDs, resets repeat rate and delay to defaults and disable the keyboard scan. 0xF6 - Set defaults This command resets the keyboard, clears the output buffer, switch off the LEDs and resets repeat rate and delay to defaults. 0xFE - Resend Forces the keyboard to resend the last byte sent. 0xFF - Keyboard reset Reset and runs a self-test. The self-test (BAT) will return aa if OK or fc if there is a problem. During this test, all the LEDs flashes once. The keyboard commands The keyboard will respond to host commands or to external events (like key presses) with it's own commands as follows: 0xFA - Acknowledge (ACK) Sends the ACK command to the host when needed. 0xAA - Power on self test passed (BAT completed) When the host sends a reset command to the keyboard (ff), it must run a self test and answer with this command. 0xEE - Echo This command requests an echo return by the host (again 0xEE). 0xFE - Resend Forces the host to resend the last byte sent. 0x00 - Error or buffer overflow This command is sent when an error or a buffer overflow occurs. 0xFF - Error or buffer overflow This command is sent when an error or a buffer overflow occurs. Relative pages Comments
|
|
Contact
Forum
Projects
Experiments
Circuits
Theory
BLOG
PIC Tutorials
Time for Science
RSS
Site design: Giorgos Lazaridis © Copyright 2008 Please read the Terms of services and the Privacy policy |