Ps2 Protocol

  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Ps2 Protocol as PDF for free.

More details

  • Words: 2,189
  • Pages: 73
PS/2 Mouse Based X-Y Plotter Kushal Infotech Pvt. Lt. EXTERNAL GUIDE: Mr. G. Ghate INTERNAL GUIDE: Mrs. Preeti Salunkhe  Swapna

Jadhav  Rani Pawal  Rachana Kale  Aarti Toshniwal

OUTLINE         

Introduction Block diagram PS/2 protocol Flow Chart ARM AX4510 BOARD X Y plotter Stepper motor interface Conclusion Future plans

INTRODUCTION & BLOCK DIAGRAM

INTRODUCTION  Aim

:

Project is to track a Ps/2 mouse and use it to control a X– Y plotter.

Plotter  Plotter

is a device that draws pictures or diagrams under computer control.

 Plotter

is a vector graphics printing device that connects to a computer.

Continue…  Plotters

are used primarily in technical drawing and CAD applications

 Advantage

of working on very large paper sizes while maintaining high resolution.

Types of plotter 

Two types of plotter



Flatbed plotters Pen movement up & down across flat drawing surface.



Roller plotters Roll the drawing paper past pen movement side to side.

Why Plotter /Why Not Printer “When computer memory was very expensive and processor power was very slow plotter was often the fastest way to produce very large drawing efficiently.”

Plotter  APPLICATION:      

In technical drawing and CAD application. Garments and sign shop. In Biomedical fields for diagnosis. In Embedded field as web plotter. As navigation plotter to detect boat position. Ink Jet printer. Business charts, architectural plans, and engineering drawing.

PS/2 Mouse based Plotter  Major

blocks in our Plotter  Ps/2 mouse  Arm Board AX4510  Two stepper motor for X,Y movement OR The 2600 a compact 8-pen plotter with inbuilt stepper motor

Block Diagram 

Ps/2 mouse based X-Y plotter

Stepper motor PS/2 Mouse

AX4510 Board

X Y plotter Stepper motor

Block Description  PS/2

mouse is connected to 6 pin mini din female socket available at AX4510 board.

 Ax4510  Output

board reads X & Y movement

from Arm Board given to Stepper motor

PS/2 BYTE FORMAT  PS/2

SENT FRAME OF 11/12 BITS  1 start bit (always zero)  8 data bits (LSB first)  1 parity bit (odd parity)  1 stop bit (always one)  1 acknowledge (host to device communication)

Continue…  Byte        

1  Bit 7 - Y Overflow Bit 6 - X Overflow Bit 5 - Y sign bit Bit 4 - X sign bit Bit 3 - Always 1 Bit 2 - Middle Button Bit 1 - Right Button Bit 0 - Left Button

Continue…  BYTE

2  X Movement  BYTE

3  Y Movement

Achieved Block Diagram

PS/2 Mouse

AX4510 Board

Stepper motor

Why AX4510 Arm Board 





Embest AX4510 EVB is a platform that is suitable for code development of Samsung's S3C4510B(ARM7TDMI) RISC microcontroller. Embest AX4510 EVB provides a high performance & low cost solution for EMBEDDED ENGINEER. Boundary scan is a method for testing interconnects (thin wire lines) on printed circuit boards or sub-blocks inside an integrated circuit.

Why Stepper Motor Motors convert electrical energy into mechanical energy. A stepper motor converts electrical pulses into specific rotational movements. The movement created by each pulse is precise and repeatable, which is why stepper motors are so effective for positioning applications.

Embest IDE       

An Integrated Development Environment (IDE). Project management facility. Integrated source-code editor. GNU compilers, assembler and linker. GNU ANSI C library. Supports ARM build tools. Source-level debugger.

Features  Low

Power Consumption  Less Hardware Requirement  Extensive debug facilities (Embedded ICE debug unit accessible via JTAG interface unit)  Fastest execution with good resolution

PS/2 Mouse protocol Flow chart

PS/2 MOUSE PROTOCOL  

The PS/2 mouse interface originally appeared in IBM's "Personal System/2" computers . The physical PS/2 connector is 6 pin-mini-DIN connector

PS/2 MOUSE PROTOCOL 

The PS/2 mouse interface uses a bidirectional serial protocol to transmit movement and button-position.



The computer send a number of commands to the mouse to set the resolution, reset the mouse, disable the mouse, etc.

PS/2 MOUSE PROTOCOL  The standard PS/2 mouse interface supports

the following inputs:  X (right/left) movement  Y (up/down) movement  Left button  Middle button  Right button.

…….

PS/2 MOUSE PROTOCOL 

When mouse moves it sends 3 byte of information through PS-2 port to the host.

 The movement counters are 9-bit , where the MSB

appears as a sign bit in Byte 1 of the movement data packet.

PS/2 MOUSE PROTOCOL  Mouse can send data to host and host can send data

  

to mouse, but host has always priority to bus and can inhibit communication at any time by holding clock low. Data sent from mouse to host is read on the falling edge of the clock. Data sent from host to mouse is read on the rising edge of the clock. Regardless of direction of communication mouse always generates the clock.

PS/2 MOUSE PROTOCOL 1 Start bit (always 0)  8 data bit ( LSB first)  1 parity bit (Odd parity)  1 stop bit (This is always 1)  1 Acknowledge bit (host to Device communication). 

Bus States  Data

= high, Clock = high:  Idle state.

 Data

= high, Clock = low:  Communication Inhibited.

 Data

= low, Clock = high:  Host Request-to-Send

 

Device to host Communication

Host to Device communication

Flowchart  Main

Routine

Start

Call port initialization routine

Call PS2 Initialization routine

End

Port Initialization Start

Configure Register for ULCON0 for 8 data bits,1 start bit,1 stop bit. UBRDIV0 register for 19200 baud rate. UCON for transmission enable

End

PS/2 Routine Transmit commands: Call Host_to_Mouse

Start Call Mouse_To_Host Function

Yes Yes

Check for self test

RET Check for ID No

No

Get error

Host To Mouse A

Start Call calculate parity function

Release clk Initialization counter=1

Pull clock line low for 100us Pull data line low A

J No

Wait for clk High

Yes

B

C

Contd…. Wait for rising edge of clk

B Shift 8 data bits On data lineLSB Ist

Transmit parity bit

Increment counter J

No

No

Counter==8

C Yes

Wait for rising edge of clk

No D

Contd…

E

Resend

Check for the ack

D Transmit stop bit Call Mouse_To_Host Routine

E

Yes Release data and clk line

Return

No

Mouse_To_Host F Start

NO

Wait for CLK high Delay for 50us NO

Is clock High YES F

Is data High YES Delay for 40us

NO YES

Is clock High G

Transmit start bit

Increment counter

H ON

Delay for 20us Initialise counter=1

Is counter ==8 YES

Wait for clk Falling edge YES Transfer data bit By bit LSB Ist H

NO

Wait for 2 Clk pulse YES RET

ON

AX4510 Board

Continue… 

Embest AX4510 for S3C4510B is a platform that is suitable for code development of Samsung's S3C4510B(ARM7TDMI) RISC microcontroller (General ARM) for network applications and general applications.



The S3C4510B is based on 16/32-bit ARM7TDMI RISC processor. It offers a configurable 8K-byte unified cache/SRAM and Ethernet controller which reduces total system cost.

   

5.0V DC or USB power supply 10M/100M Ethernet interface connector(RJ45) 2 PS2 port 20-pin JTAG interface connector

PLOTTER & STEPPER MOTOR

X-Y Plotter (2600)  The 2600 is a compact 8-pen plotter with full

compatibilities and high cost performance.

The 2600 features :  Plotter commands consist of one or two characters

and are easily used with BASIC. 

High resolution (0.05 mm steps)

 Serial interfaces can be included  High speed drawing

Keys on x - y plotter  Scaling point keys (p1, p2)  Enter keys  Pause key  Fast keys  Pen up/down key  Positioning keys  Home key

Commands  DXY commands:  

used with the Anika series of plotters improved to enable all programs for the 2600 to use this mode

Stepper Motors  

Stepper motors allow for excellent control of angular position.



The precision of the motor is determined by the number of full steps (or just steps) per revolution.



A fine-resolution stepper might have 200 steps/rev. (1.8 deg./step).        

Stepper Motors  

Stepper motors allow for excellent control of angular position.



The precision of the motor is determined by the number of full steps (or just steps) per revolution.



A fine-resolution stepper might have 200 steps/rev. (1.8 deg./step).        

Features  Product name: NEMA 17HD hybrid stepping motor  Step angle: 1.8 or 0.9°  Body length: 28, 34,38,40,44,48mm  Shaft style: single or double  Lead wires: 4 or 6  with low noise, high torque, and stable performance.  Voltage Rating 12V(dc)  2 Phase  UNIPOLAR Operation

1.8° Step Angle  Applying the correct electrical pulse sequence to the

windings of the stepper motor results in a 1.8° step angle rotation of the spindle (i.e. 200 steps per revolution).

Step Angle  Step angle is the minimum degree of rotation

associated with a single step  To calculate: divide 360 by number of steps a motor takes to complete one revolution.  Stepper Motor rotating in full mode takes 4 steps to complete a revolution  Step / Sec = RPM * Steps Per Revolution/60  So step angle can be calculated as... Step Angle ø = 360° / 4 = 90°

Basic Step Motor System

controller

Driver

Motor

Description  Controller

will give output sequences according to X_Y movement of mouse that motor will follow.  Driver’s function is to control magnitude and direction of current flow into the motor windings.  All step motor operate through the principle of the rotor following rotating magnetic field created by sequencing the flow of current through stator windings.

Driver IC ULN2803  8-bit,

50V, 500mA ,TTL-input NPN Darlington driver.  Current sinking.

STEP MODES  Stepper

motor: "step modes" include Full, Half and Micro step.  Full Step Standard (hybrid) stepping motors have 200 rotor teeth, or 200 full steps per revolution of the motor. shaft. Dividing the 200 steps into the 360º's rotation equals a 1.8º full step angle.

Continue…  HALF STEP  Half

step simply means that the motor is rotating at 400 steps per revolution.

 MICROSTEP  AMS

microstepers are capable of rotating at 1/256 of a step (per step), or over 50,000 steps per revolution.

Two Phase Stepper Motors 

Unipolar Stepper Motor:

Five or six wires and four coils(actually two coils divided by center connection on each coil)  Center connections of the coils used as the power connection.  They are called unipolar steppers because power always comes in on this one pole. 



Bipolar stepper motor:

 Four wires coming out of it.  No comman center connection. 

Bipolar v/s Unipolar 

Unipolar

• •

Simple driving circuit because no current reversal. Size comparatively larger for same specification as bipolar.



Bipolar

.

 Smaller size  Higher torque  Complex driving circuit because current has to be

reverse

main Configure the 8 IO port pin as output Configure IOPDATA for writing those port pin

A

A Out 66 on port pins Initialise counter=0 Rotate the sequence Apply it to port pins B

C

C

B Is counter<4 stop

No

CONCLUSION & FUTURE PLAN

ACHIEVED RESULT Input Interface:  At

input interface we got a error command instead of acknowledgement command.  For getting acknowledgement command we try to modify our code.  But after modification we even couldn’t able to receive CLK from mouse

Continue… Output Interface:  We

were tried to interface stepper motor to arm board & we were generated only sequence for stepper motor.

FUTURE PLANNING 





The arm board accept 3 Byte information from mouse, that 3 Byte perform different operation. We may add following features to our project for controlling plotter Pen movement by PS/2 mouse button. We will Provide following functionality to mouse buttons: 1] Scaling key (LEFT BUTTON) 2] Pause key (RIGHT BUTTON) 3] Enter key (MIDDLE BUTTON)

Continue…  In

future we will try to sense the button position value of PS/2 mouse.

 According

to PS/2 mouse movement stepper motor will move in forward or in reverse direction.

Continue… 

When Scaling key (Left Button) will be press ones ,pen will be raise & move to scaling point P1/ P2 on plotter, when again press pen is lower.



When Pause key will be press execution of program will be halt, by again pressing key, program will be executed.



By pressing middle button scaling point will be set.

CONCLUSION 

This Project is very challenging, interesting, motivating.



The actual objective of our Project is to move the plotter according to X-Y position of PS/2 mouse.



But actual achievement in our project is input interface of the mouse with AX4510 Board.

Continue…  We

were implemented mouse initialization code

 For

output we were implemented software for stepper motor .

 With

the help of this we were trying to generate the sequence of motor on LED & we got the sequence.

THANK YOU

QUERIES ?

Related Documents

Ps2 Protocol
October 2019 25
Ps2
October 2019 37
Ps2
November 2019 39
Desarmar Ps2
October 2019 33
Ps2 Igre
April 2020 30
Protocol
November 2019 45