1 COMP541 Input Devices: Keyboards, Mice and Joysticks Montek Singh Apr 6, 2015.

Slides:



Advertisements
Similar presentations
1.Obtain laser pointer coordinates 2.Send laser pointer coordinates to laptop through the PS/2 port 3.Pixel Mapping between camera image and laptop screen.
Advertisements

INPUT-OUTPUT ORGANIZATION
MM Player Supervised by: Dr. Luai Malhis. Prepared by: Mustafa Assaf & Mahmoud Musa.
Input and Output CS 215 Lecture #20.
8051 I/O Interfacing Need for more ports PPI 8255
Programmable Keyboard/ Display Interface: 8279
kashanu.ac.ir Microprocessors 6-1 I/O Devices Switches, LED, LCD Lec note 6.
Input/Output Ports and Interfacing ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Henry Hexmoor1 Chapter 7 Henry Hexmoor Registers and RTL.
EE 316 Computer Engineering Junior Lab Word Mastermind.
EE 316 Computer Engineering Junior Lab PS/2 Keyboard.
Other I/O LCD display Flash ROM Keyboard (PS/2) UART connectors.
1 COMP541 Keyboard Interface Montek Singh April 9, 2007.
CS150 Project Checkpoint 1. Controller Interface Dreamkatz Controller Interface 1. The N64 Controller 2. Physical interface 3. Communication protocol.
3D Wireless Mouse Shirley Li Matt Tanwentang Joseph Cheng.
1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014.
COMP541 Input Devices: Keyboards, Mice and Joysticks
EE 316 Computer Engineering Junior Lab Digital Hangman.
Practical Session No. 10 Input &Output (I/O). I/O Devices Input/output (I/O) devices provide the means to interact with the “outside world”. An I/O device.
1 COMP541 State Machines – 2 Registers and Counters Montek Singh Feb 8, 2007.
Interface circuits I/O interface consists of the circuitry required to connect an I/O device to a computer bus. Side of the interface which connects to.
Counters and Registers
1 Keyboard Controller Design By Tamas Kasza Digital System Design 2 (ECE 5572) Summer 2003 Presentation for.
University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi.
1 KEYBOARD. 2 Structure  Is standard input device Arrangement of keys IC Integrated Circuit.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Keyboard Interface Anselmo Lastra.
PS/2 Mouse/Keyboard Port Discussion D7.2. PS/2 Port.
PS2 Keyboard Interface Using Spartan-3 Starter Kit Board
INPUT-OUTPUT ORGANIZATION
Chapter 8 Input/Output l I/O basics l Keyboard input l Monitor output l Interrupt driven I/O l DMA.
1 COMP541 Input Devices: Keyboards, Mice and Joysticks Montek Singh Apr 16, 2012.
Digilent System Board Capabilities Serial Port (RS-232) Parallel Port 1 Pushbutton Hint: Good for a reset button Connected to a clock input. See Digilent.
Dr. Rabie A. Ramadan Al-Azhar University Lecture 6
Input/Output Ports and Interfacing
1. Introduction 2. Methods for I/O Operations 3. Buses 4. Liquid Crystal Displays 5. Other Types of Displays 6. Graphics Adapters 7. Optical Discs 10/01/20151Input/Output.
Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN.
8086/8088 Hardware Specifications Power supply:  +5V with tolerance of ±10%;  360mA. Input characteristics:  Logic 0 – 0.8V maximum, ±10μA maximum;
(More) Interfacing concepts. Introduction Overview of I/O operations Programmed I/O – Standard I/O – Memory Mapped I/O Device synchronization Readings:
EE4OI4 Engineering Design UP1core Library Functions.
1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Apr 11, 2012.
8279 KEYBOARD AND DISPLAY INTERFACING
Practical Session 11 Computer Architecture and Assembly Language Input &Output (I/O)
Shift Registers pp Shift Registers Capability to shift bits ♦ In one or both directions Why? ♦ Part of standard CPU instruction set ♦ Cheap.
Monday, January 14 Homework #1 is posted on the website Homework #1 is posted on the website Due before class, Jan. 16 Due before class, Jan. 16.
8279 KEYBOARD AND DISPLAY INTERFACING
PS/2 Mouse/Keyboard Port
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 COMP541 State Machines – 2 Registers and Counters Montek Singh Feb 11, 2010.
The Spartan®-3E FPGA Starter Kit board. A computer mouse is designed mainly to detect two-dimensional motion on a surface. Its internal circuit measures.
KEYBOARD INTERFACING Keyboards are organized in a matrix of rows and columns The CPU accesses both rows and columns through ports. ƒTherefore, with two.
Chapter 3 System Buses.  Hardwired systems are inflexible  General purpose hardware can do different tasks, given correct control signals  Instead.
Practical Session 12 Input &Output (I/O). I/O Device Input / Output (I/O) devices Input / Output (I/O) devices provide the means to interact with the.
REGISTER TRANSFER LANGUAGE (RTL) INTRODUCTION TO REGISTER Registers1.
I/O Devices Switches, LED, LCD
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Practical Session 11 Computer Architecture and Assembly Language Input &Output (I/O)
1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Apr 6, 2010.
INTERFACING KEYBOARD WITH ATMEGA32 ELECTRONICS & COMMUNICATION TITLE.
Michael Rahaim, PhD Candidate Multimedia Communications Lab
Chapter 6 Input/Output Organization
Peripherals – Keypad The Keypad provides a simple means of numerical data or control input. The keys can be attributed whatever data or control values.
COMP541 Input Devices: Keyboards, Mice and Joysticks
Control Unit Lecture 6.
Operating Systems (CS 340 D)
Serial I/O and Data Communication.
COMP541 Input Devices: Keyboards, Mice and Joysticks
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
EEL 3705 / 3705L Digital Logic Design
Computer Architecture and Assembly Language
Interfacing keyboard with FPGA
Presentation transcript:

1 COMP541 Input Devices: Keyboards, Mice and Joysticks Montek Singh Apr 6, 2015

Keyboard Interface USB keyboard plugs into the USB port on Nexys 4 boards

3 USB to PS/2 emulation  Host controller on Nexys boards talks to USB keyboard on one side talks to USB keyboard on one side speaks PS/2 protocol to the FPGA on the other side speaks PS/2 protocol to the FPGA on the other side  PS/2 used to be the dominant keyboard protocol  PS/2 = a synchronous serial protocol What does that mean? What does that mean? Each symbol is transmitted bit-by-bit Each symbol is transmitted bit-by-bit  8 data bits + 3 control bits  synchronized to the keyboard’s clock (slow)

4 Physical Interface  Two lines Clock (15-20KHz) Clock (15-20KHz) Data Data Normally high, asserted low Normally high, asserted low  Read: pp of Nexys 3 manual pp of Nexys 3 manual pg. 10 of Nexys 4 manual pg. 10 of Nexys 4 manual

5Protocol  Bidirectional Kybd-to-host and host-to-kybd on same wires Kybd-to-host and host-to-kybd on same wires  CAPS LOCK light for example  Assert low To send, keyboard starts clocking To send, keyboard starts clocking  sends successive bit on positive edge of clock  host reads bits on negative edges of clock  For your lab: You shouldn’t need to send anything to keyboard You shouldn’t need to send anything to keyboard

Protocol  11 bits a start bit: always 0 a start bit: always 0 8 bits of data 8 bits of data  lsb first one parity bit (odd) one parity bit (odd) a stop bit: always 1 a stop bit: always 1  Clocked by keyboard Value should be latched by FPGA on neg edge of keyboard clock Value should be latched by FPGA on neg edge of keyboard clock 6 Illustration from

7 What is Sent  ASCII is not sent!  Scan codes for keys Most keys have an 8-bit (single byte) scancode Most keys have an 8-bit (single byte) scancode Some have two bytes Some have two bytes A few have even more! A few have even more! Most (not all, be careful!) keyboards use these scancodes: Most (not all, be careful!) keyboards use these scancodes: Illustration from Nexys 3 manual Our keyboards have slightly different scan codes! Check before using!

8 Scan Codes  Normally translated by software You remap your keys, for example You remap your keys, for example  Software takes care of Shift, caps lock, control Shift, caps lock, control

9 Some Scan Codes Long  Two code sequence common Some special keys use even more… Some special keys use even more…  …have a look at Break key!

10 Even More Complicated  Scan code generated when you press  And when you release Extra byte: F0 followed by key scan code Extra byte: F0 followed by key scan code Example: Example:  Space pressed, 29 sent  Space released, F0 29 sent

11Resources  Information  Scan codes  Available on the class website: my Verilog for keyboard my Verilog for keyboard

12 My Verilog  Have Verilog for keyboard a test/demo which displays data from keyboard onto 7- segment display a test/demo which displays data from keyboard onto 7- segment display have tested it with the FPGA kit; seems to work fine have tested it with the FPGA kit; seems to work fine  To use: You will memory-map the character code register You will memory-map the character code register  give the keyboard a memory address so the CPU can read it using lw instructions Handle presses and releases appropriately in software Handle presses and releases appropriately in software  Either: Check for a key release before reading a new key press  OR: Delaying next key read (by, say, 1/4 th sec) –gives you automatic “key repeat” feature!

Mice 13

Mouse  Very similar interface (clk & data) But: 3 words sent w/ mouse movement or button press But: 3 words sent w/ mouse movement or button press  Read pp of Nexys 4 manual pp of Nexys 4 manual  Verilog I can guide you to modify keyboard.v to read 3 bytes I can guide you to modify keyboard.v to read 3 bytes 14

Movement  Movement is relative XS, YS are sign (+ is up/right) XS, YS are sign (+ is up/right) XY, YY are overflow (too fast) XY, YY are overflow (too fast) L, R are buttons L, R are buttons 15

Scroll Wheel, etc.  Extensions to original 2 button PS/2 mouse See See

Joystick

Joystick module  2 axes: x and y 10-bit position values 10-bit position values  On-board microprocessor handles debouncing handles debouncing communicates with host communicates with host  Info on class website reference manual reference manual Verilog code Verilog code  demo: feeds joystick output to the 7- seg display  you will modify to feed the output into your memory-mapped I/O unit instead 18

Accelerometer Nexys 4 boards have built-in accelerometer We are working on a Verilog module for it… 19

Keypad 20

Keypad module  4x4 keypad 0-9, A-F 0-9, A-F one hex character input one hex character input  Simple interface 4-bit row, 4-bit column 4-bit row, 4-bit column a ‘0’ means pressed a ‘0’ means pressed  Info on class website reference manual reference manual Verilog code Verilog code  demo: feeds keypad output to the 7-seg display  you will modify to feed the output into your memory- mapped I/O unit instead 21

Stereo Audio Amplifier Nexys 4 has mono amplified built-in, but you can also attach a stereo module (read on…) 22

Amplifier module  Stereo output headphone jack compatible headphone jack compatible  Very very low-level…! expects analog waveform on input! expects analog waveform on input! your design on FPGA will have to generate an analog value by rapidly toggling between 0 and 1 your design on FPGA will have to generate an analog value by rapidly toggling between 0 and 1  e.g., 60% of the time ‘1’ value will approximate an analog value of 0.60V (if range is 0-1V)  Verilog code We are working on it … We are working on it … 23