PS/2 Mouse/Keyboard Port Discussion D7.2. PS/2 Port.

Slides:



Advertisements
Similar presentations
VHDL Lecture 1 Megan Peck EECS 443 Spring 08.
Advertisements

28/10/2007DSD,USIT,GGSIPU1 Latch & Register Inference.
Arbitrary Waveform Discussion 5.5 Example 34.
7-Segment Display: Spartan-3 board
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
Shifters Discussion D7.1 Example Bit Shifter.
Ring Counter Discussion D5.3 Example 32. Ring Counter if rising_edge(CLK) then for i in 0 to 2 loop s(i)
Decoders and Encoders Lecture L4.2. Decoders and Encoders Binary Decoders Binary Encoders Priority Encoders.
Logic Design Fundamentals - 3 Discussion D3.2. Logic Design Fundamentals - 3 Basic Gates Basic Combinational Circuits Basic Sequential Circuits.
RS-232 Port Discussion D7.1. Loop feedback RS-232 voltage levels: +5.5 V (logic 0) -5.5 V (logic 1)
Integer Square Root.
Simple Sequential Circuits in VHDL. Contents Sequential circuit examples: - SR latch in dataflow style - D flip-flop in behavioral style - shift register.
EE 316 Computer Engineering Junior Lab Word Mastermind.
EE 316 Computer Engineering Junior Lab PS/2 Keyboard.
Digilent Spartan 3 Board Lecture L2.2
Structural VHDL VHDL Tutorial R. E. Haskell and D. M. Hanna T3: ALU Design.
PS/2 Mouse/Keyboard Port Lecture L9.4. PS/2 Port.
1 COMP541 Keyboard Interface Montek Singh April 9, 2007.
Counters Discussion D5.3 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
7-Segment Display DIO1 Board. Digilab2 – DIO1 Boards Four 7-segment displays A0A1A2A3.
Lab 2 4-Bit Adder Digilent Spartan 3 Board Lecture L2.3.
Digilab 7-Segment Displays Lab 4. selyInstruction name “000”true if b = a false otherwise = “001”true if b /= a false otherwise “010”true if b < a.
Sequencing and Control Mano and Kime Sections 8-1 – 8-7.
7-Segment Displays Digilent Spartan 3 Board Discussion DS-4.2.
VGA Port Discussion D9.1. Raster Scan Displays Electron beam CRT.
Division Discussion D11.3. Division
COMP541 Input Devices: Keyboards, Mice and Joysticks
EE 316 Computer Engineering Junior Lab Digital Hangman.
Shift Registers Discussion D5.2 Example Bit Shift Register qs(3) qs(2) qs(1) qs(0) if rising_edge(CLK) then for i in 0 to 2 loop s(i) := s(i+1);
1 Keyboard Controller Design By Tamas Kasza Digital System Design 2 (ECE 5572) Summer 2003 Presentation for.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Keyboard Interface Anselmo Lastra.
PS2 Keyboard Interface Using Spartan-3 Starter Kit Board
4-bit Shift Register. 2-bit Register Serial-in-serial-out Shift Register.
1 COMP541 Input Devices: Keyboards, Mice and Joysticks Montek Singh Apr 16, 2012.
1 Part V: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
1 Copyright (c) 2003 by Valery Sklyarov and Iouliia Skliarova: DETUA, IEETA, Aveiro University, Portugal.
UART ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering.
ENG241 Digital Design Week #8 Registers and Counters.
Copyright(c) 1996 W. B. Ligon III1 Getting Started with VHDL VHDL code is composed of a number of entities Entities describe the interface of the component.
1 COMP541 Input Devices: Keyboards, Mice and Joysticks Montek Singh Apr 6, 2015.
2’s Complement 4-Bit Saturator Discussion D2.8 Lab 2.
Feb. 26, 2001Systems Architecture I1 Systems Architecture I (CS ) Lecture 12: State Elements, Registers, and Memory * Jeremy R. Johnson Mon. Feb.
Copyright (c) 2003 by Valery Sklyarov and Iouliia Skliarova: DETUA, IEETA, Aveiro University, Portugal.
PS/2 Mouse/Keyboard Port
 Seattle Pacific University EE Logic System DesignCounters-1 Shift Registers DQ clk DQ DQ ShiftIn Q3Q3 Q2Q2 DQ Q1Q1 Q0Q0 A shift register shifts.
CEC 220 Digital Circuit Design VHDL in Sequential Logic Wednesday, March 25 CEC 220 Digital Circuit Design Slide 1 of 13.
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.
Copyright (c) 2003 by Valery Sklyarov and Iouliia Skliarova: DETUA, IEETA, Aveiro University, Portugal.
Number Representation and Arithmetic Circuits
July 2, 2001Systems Architecture I1 Systems Architecture II (CS 282) Lab 3: State Elements, Registers, and Memory * Jeremy R. Johnson Monday July 2, 2001.
Registers and Counters Discussion D8.1. Logic Design Fundamentals - 3 Registers Counters Shift Registers.
Combinational logic circuit
LAB #6 Sequential Logic Design (Flip Flops, Shift Registers)
Describing Combinational Logic Using Processes
COMP541 Input Devices: Keyboards, Mice and Joysticks
Registers and Counters
Part III: SYSTEM DESIGN
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Part IV: VHDL CODING.
COMP541 Input Devices: Keyboards, Mice and Joysticks
ECE 4110–5110 Digital System Design
Field Programmable Gate Array
Field Programmable Gate Array
Field Programmable Gate Array
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
مدار های ترکیبی دیکدر لامپ های هفت قسمتی یکی از دیکدر هایی که اغلب به کار برده می شود،دیکدر 4 به 7 برای تبدیل کد bcd به کد هفت بیتی برای لامپ های seven.
A Greatest Common Divisor (GCD) Processor
Founded in Silicon Valley in 1984
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
(Sequential-Circuit Building Blocks)
Presentation transcript:

PS/2 Mouse/Keyboard Port Discussion D7.2

PS/2 Port

PS/2 Port Timing The clock frequency must be in the range kHz. Data sent from the device to the host is read on the falling edge of the clock signal. Data sent from the host to the device is read on the rising edge.

Summary: Bus States Data = high, Clock = high: Idle state. Data = high, Clock = low: Communication Inhibited. Data = low, Clock = high: Host Request-to-Send Device always generates the clock signal Data is transmitted one byte at a time Each byte is sent in a frame consisting of bits. 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)

Keyboard

Make and Break Codes Keyboard Scan Codes – Set 2

Scan code = 15h (Q) PS/2 Port Timing ~25 KhZ clock

Keyboard.vhd -- Demonstrate basic keyboard function Author: Ken Nelson -- Copyright 2004 Digilent, Inc DESCRIPTION Revision History: -- 06/14/04 (Created) KenN -- 07/01/04 (Optomized) DanP library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity keyboardVhdl is Port (CLK, RST, KD, KC: in std_logic; an: out std_logic_vector (3 downto 0); sseg: out std_logic_vector (6 downto 0)); end keyboardVhdl;

architecture Behavioral of keyboardVhdl is signal clkDiv : std_logic_vector (12 downto 0); signal sclk, pclk : std_logic; signal KDI, KCI : std_logic; signal DFF1, DFF2 : std_logic; signal shiftRegSig1: std_logic_vector(10 downto 0); signal shiftRegSig2: std_logic_vector(10 downto 1); signal MUXOUT: std_logic_vector (3 downto 0); signal WaitReg: std_logic_vector (7 downto 0); begin --Divide the master clock down to a lower frequency-- CLKDivider: Process (CLK) begin if (CLK = '1' and CLK'Event) then clkDiv <= clkDiv +1; end if; end Process; sclk <= clkDiv(12); KHz 164 us period pclk <= clkDiv(3); MHz 0.32 us period

--Flip Flops used to condition signals coming from PS2-- Process (pclk, clr, KC, KD) begin if(clr = '1') then DFF1 <= '0'; DFF2 <= '0'; KDI <= '0'; KCI <= '0'; else if (pclk = '1' and pclk'Event) then DFF1 <= KD; KDI <= DFF1; DFF2 <= KC; KCI <= DFF2; end if; end process; Filter clock and data signals from PS/2 port pclk KD DFF1 KDI pclk KC DFF2 KCI pclk <= clkdiv(3); MHz0.32 us period

--Shift Registers used to clock in scan codes from PS2-- Process(KDI, KCI, RST) begin if (RST = '1') then ShiftRegSig1 <= " "; ShiftRegSig2 <= " "; else if (KCI = '0' and KCI'Event) then ShiftRegSig1(10 downto 0) <= KDI & ShiftRegSig1(10 downto 1); ShiftRegSig2(10 downto 1) <= ShiftRegSig1(0) & ShiftRegSig2(10 downto 2); end if; end process; ShiftRegSig1 ShiftRegSig2 KDI D7D6D5D4D3D2D1D0P1 0 D7D6D5D4D3D2D1D0P1

--Wait Register process(ShiftRegSig1, ShiftRegSig2, RST, KCI) begin if(RST = '1')then WaitReg <= " "; else if(KCI'event and KCI = '1' and ShiftRegSig2(8 downto 1) = " ")then WaitReg <= ShiftRegSig1(8 downto 1); end if; end Process; F0

MUXOUT <= WaitReg(7 downto 4) when sclk = '1' else WaitReg(3 downto 0); --Seven Segment Decoder-- sseg <=" " when MUXOUT = "0000" else " " when MUXOUT = "0001" else " " when MUXOUT = "0010" else " " when MUXOUT = "0011" else " " when MUXOUT = "0100" else " " when MUXOUT = "0101" else " " when MUXOUT = "0110" else " " when MUXOUT = "0111" else " " when MUXOUT = "1000" else " " when MUXOUT = "1001" else " " when MUXOUT = "1010" else " " when MUXOUT = "1011" else " " when MUXOUT = "1100" else " " when MUXOUT = "1101" else " " when MUXOUT = "1110" else " " when MUXOUT = "1111" else " "; --Anode Driver-- an(3) <= '1'; an(2) <= '1'; --disable first two 7-segment decoders. an(1 downto 0) <= "10" when sclk = '1' else "01"; end Behavioral;

Host-to-Device Communication

1) Bring the Clock line low for at least 100 microseconds. 2) Bring the Data line low. 3) Release the Clock line. 4) Wait for the device to bring the Clock line low. 5) Set/reset the Data line to send the first data bit 6) Wait for the device to bring Clock high. 7) Wait for the device to bring Clock low. 8) Repeat steps 5-7 for the other seven data bits and the parity bit 9) Release the Data line. 10) Wait for the device to bring Data low. 11) Wait for the device to bring Clock low. 12) Wait for the device to release Data and Clock Host-to-Device Communication

Mouse Speed of mouse pressing left & right button sign overflow

mouse.vhd source code