The PS/2 Keyboard and Mouse Interface



Similar documents
The PS/2 Keyboard and Mouse Interface

Appendix C: Keyboard Scan Codes

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

Implementing SPI Master and Slave Functionality Using the Z8 Encore! F083A

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction

Quick Installation. A Series of Intelligent Bar Code Reader with NeuroFuzzy Decoding. Quick Installation

If anything is damaged or missing, contact your dealer.

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

LINDY ELECTRONICS LIMITED & LINDY-ELEKTRONIK GMBH - SECOND EDITION

CENTRONICS interface and Parallel Printer Port LPT

AN1754 APPLICATION NOTE

Serial Communications

2 ASCII TABLE (DOS) 3 ASCII TABLE (Window)

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Old Company Name in Catalogs and Other Documents

User Manual. AS-Interface Programmer

WHQL Certification Approval...2 User Interface...3 SUNIX s COMLab..4

RS-485 Protocol Manual

8051 Serial Port. Crystal TXD. I/O Device RXD. Embedded Systems Peripherals

Measurement and Analysis Introduction of ISO7816 (Smart Card)

Application Note 120 Communicating Through the 1-Wire Master

Detecting Hardware Keyloggers. Fabian Mihailowitsch November 26, 2010

WHQL Certification Approval...2 User Interface K software FIFO 4 Universal PCI Interface...5 Ready for 64-bit System...5

SP8 Programmers 硕 飞 科 技. User's Guide. TEL: FAX: WEB:

DKVM-2KU KVM Switch with USB 2.0 Sharing with Built-In Cables. Quick Installation Guide

LDG Electronics External Meter Serial Communications Protocol Specification

USART and Asynchronous Communication

Part 1. MAX BIT DAC with an Arduino Board. MIDI to Voltage Converter Part1

How To Connect A Directsofl To A Powerpoint With An Acd With An Ctel With An Dm-Tel Modem On A Pc Or Ipad Or Ipa (Powerpoint) With A Powerline 2 (Powerline

2 Port KVM Switch. If anything is damaged or missing, contact your dealer.

INPUT/OUTPUT ORGANIZATION

PFB366 Profibus-DP Gateway User Manual

Objectives. Basics of Serial Communication. Simplex vs Duplex. CMPE328 Microprocessors (Spring ) Serial Interfacing. By Dr.

Designing a USB Keyboard and PS/2 Mouse Combination Device Using the Cypress Semiconductor CY7C63413 USB Microcontroller

KSH-3000-MI. Swipe Card Reader. ( Magnetic / IC Card two in One Reader ) Revision Reason Date V

DECT Module UM-9802 Datasheet

UART IP Core Specification. Author: Jacob Gorban

FR FAMILY MB91460 SPI - DAISY CHAIN COMMUNICATION 32-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

Command Processor for MPSSE and MCU Host Bus Emulation Modes

Embedded Systems Design Course Applying the mbed microcontroller

GEIGER COUNTER "Gamma Check Pro"

UNIT 4 Software Development Flow

Definitions and Documents

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Serial Communications (Chapter 10) RS232, SPI, I2C

Parallel IO. Serial IO. Parallel vs. Serial IO. simplex vs half-duplex vs full-duplex. Wires: Full Duplex. Wires: Simplex, Half-duplex.

Software User Guide UG-461

Single channel data transceiver module WIZ2-434

Using HyperTerminal with Agilent General Purpose Instruments

Different Ways of Connecting to. 3DLevelScanner II. A.P.M Automation Solutions LTD. Version 3.0

ADS9850 Signal Generator Module

Hardware Keylogger Detection. Andy Davis. Research and Development Manager

LAN / WAN Connection Of Instruments with Serial Interface By Using a Terminal Server

Technical Data Sheet UM-005. UM005-doc In reference to UM005-c-01.04

MSR605. Programmer s Manual. Magnetic Stripe Card Reader/Writer (High & Low Coercivity) Revision B

Metrologic MS1690 2D Scanner Installation Guide

8-bit Microcontroller. Application Note. AVR415: RC5 IR Remote Control Transmitter. Features. Introduction. Figure 1.

eztcp Technical Document Modbus/TCP of eztcp Caution: Specifications of this document may be changed without prior notice for improvement.

Technical Support Bulletin Nr.18 Modbus Tips

Software Manual RS232 Laser Merge Module. Document # SU Rev A

a8251 Features General Description Programmable Communications Interface

R&S AFQ100A, R&S AFQ100B I/Q Modulation Generator Supplement

UMBC. ISA is the oldest of all these and today s computers still have a ISA bus interface. in form of an ISA slot (connection) on the main board.

Application Note. Introduction AN2471/D 3/2003. PC Master Software Communication Protocol Specification

GW-7552 PRIFIBUS/MODBUS GATEWAY

Microprocessor & Assembly Language

Consult protocol, Nissan Technical egroup, Issue 6

NetBiter webscada Modbus User Manual

Troubleshooting Tips Lifestyle SA-2 & SA-3 Amplifier. Troubleshooting Tips

TCP/IP MODULE CA-ETHR-A INSTALLATION MANUAL

RFID MODULE Mifare Reader / Writer SL025B User Manual Version 1.4 Nov 2012 StrongLink

ModBus Server - KNX. Gateway for integration of KNX equipment into Modbus (RTU and TCP) control systems.

BIT COMMANDER. Serial RS232 / RS485 to Ethernet Converter

KVM-1501/ KVM-1508/ KVM-1516 KVM-1701/ KVM-1708/ KVM-1716 USER MANUAL

PCMCIA 1 Port RS EDITION OCTOBER 1999

RS-232 Communications Using BobCAD-CAM. RS-232 Introduction

ACU-1000 Manual Addendum Replacement of CPM-2 with CPM-4

Keep it Simple Timing

PART B QUESTIONS AND ANSWERS UNIT I

But for compatibility reasons the basic structure of the data area or the addressing mechanism of the protocol retained.

Using IDENT M System T with Modbus/TCP

ALL-USB-RS422/485. User Manual. USB to Serial Converter RS422/485. ALLNET GmbH Computersysteme Alle Rechte vorbehalten

TERMINAL Debug Console Instrument

The I2C Bus. NXP Semiconductors: UM10204 I2C-bus specification and user manual HAW - Arduino 1

Chapter 11: Input/Output Organisation. Lesson 06: Programmed IO

How to deploy console cable to connect WIAS-3200N and PC, to reset setting or check status via console

DUET / VS800 Scanner. DUET Scanner VS800 Scanner. Programming Kit

IEC-101 Slave. ProLinx Communication Gateway IEC v3 Slave (Firmware version 3.xx) PROTOCOL MANUAL

MAX6683 Evaluation System/Evaluation Kit

Serial Communications

User Manual Connection to Beckhoff ADS serial

Installing MPU-401 Compatible Cards in Windows 95

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

Laser Barcode Scanner User s Manual

Nemo 96HD/HD+ MODBUS

Virtual Integrated Design Getting started with RS232 Hex Com Tool v6.0

Linux Driver Devices. Why, When, Which, How?

Transcription:

The PS/2 Keyboard and Mouse Interface p. 1/1 The PS/2 Keyboard and Mouse Interface Prof. Stephen A. Edwards sedwards@cs.columbia.edu Columbia University Spring 2006

The IBM PC Keyboard The PS/2 Keyboard and Mouse Interface p. 2/1

The PS/2 Keyboard and Mouse Interface p. 3/1 The IBM PC Keyboard Original keyboard connector: DIN-5

The PS/2 Keyboard and Mouse Interface p. 4/1 The PS/2 Mini-DIN 6 Connector 6 5 = Data VCC = 4 3 = GND 2 1 = Clk Female Socket

The PS/2 Keyboard and Mouse Interface p. 5/1 Synchronous Serial Interface Clk Start LSB B1 B2 B3 B4 B5 B6 MSB Parity Stop Data Like RS-232, but with a clock. Odd parity, one start, one stop. Keyboard-to-host shown: keyboard initiates everything.

Codes (Keyboard to Host) 00/FF Error or buffer overflow F0 Key-up FA Acknowledge EE Echo response FE Resend E0 Extended code coming The PS/2 Keyboard and Mouse Interface p. 6/1

The PS/2 Keyboard and Mouse Interface p. 7/1 Communicating to the Keyboard Host-generated Keyboard-generated clock Clk Data Start LSB B1 B2 B3 B4 B5 B6 MSB Parity S Host-generated data Host brings Clock low, then Data low to indicate transfer to keyboard, then releases Clock (rises). Keyboard starts generating clock signals. Host supplies serial data, changing after each falling edge. After stop bit, host releases Data. Keyboard pulls Data low for one more clock

The PS/2 Keyboard and Mouse Interface p. 8/1 Commands (Host to Keyboard) ED LED control Caps lock Num lock Scroll lock EE Echo Keyboard will respond with EE F0 Set scan code set Keyboard will respond with FA and wait for another byte 01 03. 00 leaves scan code unchanged. F3 Set key repeat rate Keyboard responds with FA and waits for second byte, indicating repeat rate.

The PS/2 Keyboard and Mouse Interface p. 9/1 Commands (Host to Keyboard) F4 Enable keyboard Responds with FA, clears buffer, enables scanning. F5 Disable keyboard Responds with FA, disables keyboard. FE Resend Retransmit the last byte. FF Reset Keyboard

The PS/2 Keyboard and Mouse Interface p. 10/1 PS/2 Mouse Protocol Three bytes sent every time mouse moves or button clicked: MSB LSB Y X Y X 1 Middle Right Left Overflow Sign Buttons X movement Y movement Movement values are since last transmission: 9-bit two s-complement (signed) numbers. Many more variants, modes, and other junk.

The PS/2 Keyboard and Mouse Interface p. 11/1 Using a PS/2 Port Add lines in the.ucf file about PS2C and PS2D: NET "PS2D" LOC=m15; NET "PS2C" LOC=m16; # Data # Clock Add these ports in the add cores dialog. Make the clock pin a falling-edge-sensitive interrupt. In the.mhs file, this appears as PORT PS2D = ps2io_gpio_in, DIR = IN PORT PS2C = PS2C, DIR = IN, SIGIS = INTERRUPT, SENSITIVITY = EDGE_FALLING

The PS/2 Keyboard and Mouse Interface p. 12/1 Using a PS/2 Port Add an instance of an opb_gpio. Connect it to the OPB bus. Configure it to be a single-bit input and connect GPIO_in to the data line. In the.mhs file: BEGIN opb_gpio PARAMETER INSTANCE = ps2io PARAMETER HW_VER = 3.01.a PARAMETER C_BASEADDR = 0x80200e00 PARAMETER C_HIGHADDR = 0x80200fff PARAMETER C_ALL_INPUTS = 1 PARAMETER C_GPIO_WIDTH = 1 PARAMETER C_IS_BIDIR = 0 BUS_INTERFACE SOPB = mb_opb PORT OPB_Clk = sys_clk_s PORT GPIO_in = ps2io_gpio_in END

The PS/2 Keyboard and Mouse Interface p. 13/1 Using a PS/2 Port Add the PS/2 Clock signal to the list of interrupts handled by the opb_intc (add cores dialog). In the.mhs: BEGIN opb_intc PARAMETER INSTANCE = opb_intc_0 PARAMETER HW_VER = 1.00.c PARAMETER C_BASEADDR = 0x80200100 PARAMETER C_HIGHADDR = 0x802001ff BUS_INTERFACE SOPB = mb_opb PORT Irq = Interrupt PORT Intr = PS2C & RS232_Interrupt END

The PS/2 Keyboard and Mouse Interface p. 14/1 Using a PS/2 Port This makes a keyboard-to-host port. Interrupt signals a clock. Do the shift register in software. Register the handler and enable interrupts: microblaze_enable_interrupts(); XIntc_RegisterHandler( XPAR_OPB_INTC_0_BASEADDR, XPAR_OPB_INTC_0_SYSTEM_PS2C_INTR, (XInterruptHandler)ps2_int_handler, (void *)0 ); XIntc_mMasterEnable(XPAR_OPB_INTC_0_BASEADDR); XIntc_mEnableIntr( XPAR_OPB_INTC_0_BASEADDR, XPAR_RS232_INTERRUPT_MASK XPAR_SYSTEM_PS2C_MASK);

Interrupt Handler #define SIZE 16 unsigned char buffer[size]; int head = 0; int tail = 0; unsigned int code = 0; unsigned int bit = 11; void ps2_int_handler(void *baseaddr_p) { int next; code = (code >> 1) (XGpio_mReadReg(XPAR_PS2IO_BASEADDR, XGPIO_DATA_OFFSET) << 9); if (--bit == 0) { next = (head + 1) & (SIZE - 1); if (next!= tail) { buffer[head] = code; head = next; } bit = 11; code = 0; } XGpio_mWriteReg( /* Acknowledge interrupt */ XPAR_PS2IO_BASEADDR, XGPIO_ISR_OFFSET, 1); } The PS/2 Keyboard and Mouse Interface p. 15/1

The PS/2 Keyboard and Mouse Interface p. 16/1 Buffer Management Routines int character_available() { int result; microblaze_disable_interrupts(); result = (head!= tail); microblaze_enable_interrupts(); return result; } unsigned char get_character() { unsigned char result; microblaze_disable_interrupts(); result = buffer[tail]; tail = (tail + 1) & (SIZE - 1); microblaze_enable_interrupts(); return result; }