PS2 Protocol
-
Upload
api-3721578 -
Category
Documents
-
view
1.692 -
download
33
Transcript of PS2 Protocol
PS/2 Mouse Based X-Y PlotterPS/2 Mouse Based X-Y Plotter
Kushal Infotech Pvt. Lt.Kushal Infotech Pvt. Lt.EXTERNAL GUIDE: Mr. G. GhateEXTERNAL GUIDE: Mr. G. GhateINTERNAL GUIDE: Mrs. Preeti SalunkheINTERNAL GUIDE: Mrs. Preeti Salunkhe
Swapna JadhavSwapna Jadhav Rani PawalRani Pawal Rachana KaleRachana Kale Aarti ToshniwalAarti Toshniwal
OUTLINEOUTLINE
IntroductionIntroduction Block diagramBlock diagram PS/2 protocolPS/2 protocol Flow ChartFlow Chart ARM AX4510 BOARDARM AX4510 BOARD X Y plotterX Y plotter Stepper motor interfaceStepper motor interface ConclusionConclusion Future plansFuture plans
INTRODUCTIONINTRODUCTION
&&
BLOCK DIAGRAMBLOCK DIAGRAM
INTRODUCTIONINTRODUCTION
Aim :Aim :
Project is to track a Ps/2 Project is to track a Ps/2 mouse and use it to control a X– mouse and use it to control a X– Y plotter.Y plotter.
PlotterPlotter
Plotter is a device that draws Plotter is a device that draws pictures or diagrams under computer pictures or diagrams under computer control.control.
Plotter is a Plotter is a vector graphicsvector graphics printing deviceprinting device that connects to a that connects to a computercomputer..
Continue…Continue…
Plotters are used primarily in Plotters are used primarily in technical drawingtechnical drawing and and CADCAD applicationsapplications
Advantage of working on very large Advantage of working on very large paper sizes while maintaining high paper sizes while maintaining high resolution.resolution.
Types of plotterTypes of plotter
Two types of plotterTwo types of plotter
Flatbed plottersFlatbed plotters Pen movement up & down Pen movement up & down
across flat drawing surface. across flat drawing surface.
Roller plottersRoller plottersRoll the drawing paper past pen Roll the drawing paper past pen
movement side to side.movement side to side.
Why Plotter /Why Not PrinterWhy Plotter /Why Not Printer
“ “When computer memory was very When computer memory was very expensive and processor power expensive and processor power was very slow plotter was often was very slow plotter was often the fastest way to produce very the fastest way to produce very large drawing efficiently.” large drawing efficiently.”
PlotterPlotter
APPLICATION:APPLICATION: In technical drawing and CAD application.In technical drawing and CAD application. Garments and sign shop.Garments and sign shop. In Biomedical fields for diagnosis.In Biomedical fields for diagnosis. In Embedded field as web plotter.In Embedded field as web plotter. As navigation plotter to detect boat As navigation plotter to detect boat
position.position. Ink Jet printer. Business charts, architectural Ink Jet printer. Business charts, architectural
plans, and engineering drawing.plans, and engineering drawing.
PS/2 Mouse based PlotterPS/2 Mouse based Plotter
Major blocks in our PlotterMajor blocks in our Plotter Ps/2 mousePs/2 mouse Arm Board AX4510Arm Board AX4510 Two stepper motor for X,Y movementTwo stepper motor for X,Y movement
OR OR
The 2600 a compact 8-pen plotter The 2600 a compact 8-pen plotter with with
inbuilt stepper motorinbuilt stepper motor
Block Diagram Block Diagram
Ps/2 mouse based X-Y plotterPs/2 mouse based X-Y plotter
PS/2 Mouse AX4510 Board
Stepper motor
X Y plotterStepper motor
Block DescriptionBlock Description
PS/2 mouse is connected to 6 pin PS/2 mouse is connected to 6 pin mini din female socket available at mini din female socket available at AX4510 board.AX4510 board.
Ax4510 board reads X & Y movement Ax4510 board reads X & Y movement
Output from Arm Board given to Output from Arm Board given to Stepper motorStepper motor
PS/2 BYTE FORMATPS/2 BYTE FORMAT
PS/2 SENT FRAME OF 11/12 BITSPS/2 SENT FRAME OF 11/12 BITS 1 start bit (always zero)1 start bit (always zero) 8 data bits (LSB first)8 data bits (LSB first) 1 parity bit (odd parity)1 parity bit (odd parity) 1 stop bit (always one)1 stop bit (always one) 1 acknowledge (host to device 1 acknowledge (host to device
communication)communication)
Continue…Continue…
Byte 1 Byte 1 Bit 7 - Y OverflowBit 7 - Y Overflow Bit 6 - X OverflowBit 6 - X Overflow Bit 5 - Y sign bitBit 5 - Y sign bit Bit 4 - X sign bitBit 4 - X sign bit Bit 3 - Always 1Bit 3 - Always 1 Bit 2 - Middle ButtonBit 2 - Middle Button Bit 1 - Right ButtonBit 1 - Right Button Bit 0 - Left ButtonBit 0 - Left Button
Continue…Continue…
BYTE 2BYTE 2 X MovementX Movement
BYTE 3BYTE 3 Y MovementY Movement
Achieved Block DiagramAchieved Block Diagram
PS/2 Mouse AX4510 Board Stepper motor
Why AX4510 Arm BoardWhy AX4510 Arm Board
Embest AX4510 EVB is a platform that is Embest AX4510 EVB is a platform that is suitable for code development of Samsung's suitable for code development of Samsung's S3C4510B(ARM7TDMI) RISC microcontroller.S3C4510B(ARM7TDMI) RISC microcontroller.
Embest AX4510 EVB provides a high Embest AX4510 EVB provides a high performance & low cost solution for performance & low cost solution for EMBEDDED ENGINEER.EMBEDDED ENGINEER.
Boundary scanBoundary scan is a method for testing is a method for testing interconnects (thin wire lines) on interconnects (thin wire lines) on printed circuit boardsprinted circuit boards or sub-blocks inside or sub-blocks inside an an integrated circuitintegrated circuit..
Why Stepper MotorWhy 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 IDEEmbest IDE
An Integrated Development Environment An Integrated Development Environment (IDE). (IDE).
Project management facility. Project management facility. Integrated source-code editor. Integrated source-code editor. GNU compilers, assembler and linker. GNU compilers, assembler and linker. GNU ANSI C library. GNU ANSI C library. Supports ARM build tools. Supports ARM build tools. Source-level debugger. Source-level debugger.
FeaturesFeatures
Low Power ConsumptionLow Power Consumption Less Hardware RequirementLess Hardware Requirement Extensive debug facilities (Embedded Extensive debug facilities (Embedded
ICE debug unit accessible via JTAG ICE debug unit accessible via JTAG interface unit) interface unit)
Fastest execution with good Fastest execution with good resolutionresolution
PS/2 Mouse protocolPS/2 Mouse protocol
Flow chartFlow chart
PS/2 MOUSE PROTOCOLPS/2 MOUSE PROTOCOL
The PS/2 mouse interface originally appeared in IBM's The PS/2 mouse interface originally appeared in IBM's "Personal System/2" computers ."Personal System/2" computers .
The physical PS/2 connector is 6 pin-mini-DIN The physical PS/2 connector is 6 pin-mini-DIN connectorconnector
PS/2 MOUSE PROTOCOLPS/2 MOUSE PROTOCOL
The PS/2 mouse interface uses a The PS/2 mouse interface uses a bidirectional bidirectional serial protocol to transmit movement and serial protocol to transmit movement and button-position.button-position.
The computer send a number of commands to the The computer send a number of commands to the mouse to set the mouse to set the resolution, reset the mouse, resolution, reset the mouse, disable the mouse, etc.disable the mouse, etc.
PS/2 MOUSE PROTOCOLPS/2 MOUSE PROTOCOL
The standard PS/2 mouse interface supports The standard PS/2 mouse interface supports the following inputs: the following inputs:
X (right/left) movement X (right/left) movement Y (up/down) movementY (up/down) movement Left buttonLeft button Middle buttonMiddle button Right button. …….Right button. …….
PS/2 MOUSE PROTOCOLPS/2 MOUSE PROTOCOL
When mouse moves it sends 3 byte of information through When mouse moves it sends 3 byte of information through
PS-2 port to the host. PS-2 port to the host.
The movement counters are 9-bit , where the MSB The movement counters are 9-bit , where the MSB appears as a sign bit in Byte 1 of the movement data appears as a sign bit in Byte 1 of the movement data packet. packet.
PS/2 MOUSE PROTOCOLPS/2 MOUSE PROTOCOL
Mouse can send data to host and host can send data Mouse can send data to host and host can send data to mouse, but host has always priority to bus and can to mouse, but host has always priority to bus and can inhibit communication at any time by holding clock inhibit communication at any time by holding clock low.low.
Data sent from mouse to host is read on the falling Data sent from mouse to host is read on the falling edge of the clock.edge of the clock.
Data sent from host to mouse is read on the rising Data sent from host to mouse is read on the rising edge of the clock.edge of the clock.
Regardless of direction of communication mouse Regardless of direction of communication mouse always generates the clock.always generates the clock.
PS/2 MOUSE PROTOCOLPS/2 MOUSE PROTOCOL
1 Start bit (always 0)1 Start bit (always 0) 8 data bit ( LSB first)8 data bit ( LSB first) 1 parity bit (Odd parity)1 parity bit (Odd parity) 1 stop bit (This is always 1)1 stop bit (This is always 1) 1 Acknowledge bit (host to Device 1 Acknowledge bit (host to Device
communication).communication).
Bus StatesBus States
Data = high, Clock = high: Data = high, Clock = high: Idle state.Idle state.
Data = high, Clock = low: Data = high, Clock = low: Communication Inhibited.Communication Inhibited.
Data = low, Clock = high: Data = low, Clock = high: Host Host Request-to-SendRequest-to-Send
Device to host Communication
Host to Device Host to Device communicationcommunication
FlowchartFlowchart
Main RoutineMain RoutineStart
Call port initialization routine
Call PS2 Initialization routine
End
Port InitializationPort Initialization
Start
Configure Register forULCON0 for 8 data bits,1 start bit,1 stop bit.
UBRDIV0 register for 19200 baud rate.UCON for transmission enable
End
PS/2 RoutinePS/2 Routine
StartStart
Call Mouse_To_HostCall Mouse_To_HostFunctionFunction
Check for selfCheck for selftesttest
Transmit commands:Transmit commands:Call Host_to_MouseCall Host_to_Mouse
NoNo
YesYes
Check for IDCheck for ID
NoNo
RETRET
Get errorGet error
YesYes
Host To MouseHost To Mouse
StartStart
Pull clock line lowPull clock line lowfor 100usfor 100us
Pull data line lowPull data line low
AA
AA
Release clk Release clk
NoNo
YesYes
Initialization counter=1Initialization counter=1
BB
Call calculate parityCall calculate parityfunctionfunction
Wait for Wait for clk clk HighHigh
JJ
Contd….Contd….
BB
Shift 8 data bits Shift 8 data bits On data lineLSB IstOn data lineLSB Ist
Increment counterIncrement counter
Counter==8Counter==8NoNo
YesYes
CC
Wait for rising Wait for rising edge of clkedge of clk
CC
NoNo
Transmit parity bit Transmit parity bit
Wait for rising Wait for rising edge of clkedge of clk NoNo
DD
JJ
Contd…Contd…
DD
Transmit stop Transmit stop bit bit
Call Mouse_To_HostCall Mouse_To_HostRoutineRoutine
Check for the ackCheck for the ack
Release data and clkRelease data and clklineline
ReturnReturnEE
EE
NoNo
YesYes
Resend Resend
Mouse_To_HostMouse_To_Host
StartStart
Wait for CLK highWait for CLK highDelay for 50usDelay for 50us
Is data HighIs data High
FF
FF
NONO
NONO
YESYES
Is clockIs clockHighHigh
YESYES
Delay for 40usDelay for 40us
Is clockIs clock HighHigh
NONO
GGYESYES
Transfer data bit Transfer data bit By bit LSB IstBy bit LSB Ist
Increment Increment countercounter
Is counter ==8Is counter ==8
Wait for 2Wait for 2Clk pulseClk pulse
RETRET
HH
NONO
YESYES
YESYES
Transmit start bitTransmit start bit
Delay for 20usDelay for 20us
Wait for clk Wait for clk Falling edgeFalling edge
ONON
YESYES
Initialise counter=1Initialise counter=1
ONON
HH
AX4510 BoardAX4510 Board
Continue…Continue…
Embest AX4510 for S3C4510B is a platform that is Embest AX4510 for S3C4510B is a platform that is suitable for code development of Samsung's suitable for code development of Samsung's S3C4510B(ARM7TDMI) RISC microcontroller S3C4510B(ARM7TDMI) RISC microcontroller (General ARM) for network applications and general (General ARM) for network applications and general applications.applications.
The S3C4510B is based on 16/32-bit ARM7TDMI The S3C4510B is based on 16/32-bit ARM7TDMI RISC processor. It offers a configurable 8K-byte RISC processor. It offers a configurable 8K-byte unified cache/SRAM and Ethernet controller which unified cache/SRAM and Ethernet controller which reduces total system cost. reduces total system cost.
5.0V DC or USB power supply 5.0V DC or USB power supply 10M/100M Ethernet interface connector(RJ45)10M/100M Ethernet interface connector(RJ45) 2 PS2 port 2 PS2 port 20-pin JTAG interface connector 20-pin JTAG interface connector
PLOTTER & STEPPER MOTOR PLOTTER & STEPPER MOTOR
X-Y PlotterX-Y Plotter (2600) (2600)
The 2600 is a compact 8-pen plotter with full The 2600 is a compact 8-pen plotter with full compatibilities and high cost performancecompatibilities and high cost performance. .
The 2600 features :The 2600 features :
Plotter commands consist of one or two characters Plotter commands consist of one or two characters and are easily used with BASICand are easily used with BASIC..
High resolution (0.05 mm steps)High resolution (0.05 mm steps)
Serial interfaces can be included Serial interfaces can be included High speed drawingHigh speed drawing
Keys on x - y plotterKeys on x - y plotter
Scaling point keys (p1, p2)Scaling point keys (p1, p2) Enter keysEnter keys Pause keyPause key Fast keysFast keys Pen up/down keyPen up/down key Positioning keysPositioning keys Home keyHome key
CommandsCommands
DXY commands:DXY commands: used with the Anika series of plottersused with the Anika series of plotters improved to enable all programs for theimproved to enable all programs for the
2600 to use this mode2600 to use this mode
Stepper Motors Stepper Motors
Stepper motors allow for excellent control of angular Stepper motors allow for excellent control of angular position. position.
The precision of the The precision of the motormotor is determined by the is determined by the number of number of full stepsfull steps (or just steps) per revolution. (or just steps) per revolution.
A fine-resolution A fine-resolution stepperstepper might have 200 steps/rev. might have 200 steps/rev. (1.8 deg./step).(1.8 deg./step).
Stepper Motors Stepper Motors
Stepper motors allow for excellent control of angular Stepper motors allow for excellent control of angular position. position.
The precision of the The precision of the motormotor is determined by the is determined by the number of number of full stepsfull steps (or just steps) per revolution. (or just steps) per revolution.
A fine-resolution A fine-resolution stepperstepper might have 200 steps/rev. might have 200 steps/rev. (1.8 deg./step).(1.8 deg./step).
FeaturesFeatures
Product name: NEMA 17HD hybrid stepping motorProduct name: NEMA 17HD hybrid stepping motor Step angle: 1.8 or 0.9°Step angle: 1.8 or 0.9° Body length: 28, 34,38,40,44,48mmBody length: 28, 34,38,40,44,48mm Shaft style: single or doubleShaft style: single or double Lead wires: 4 or 6Lead wires: 4 or 6 with low noise, high torque, and stable performance. with low noise, high torque, and stable performance. Voltage Rating 12V(dc)Voltage Rating 12V(dc) 2 Phase 2 Phase UNIPOLAR OperationUNIPOLAR Operation
1.8° Step Angle1.8° Step Angle
Applying the correct electrical pulse sequence to the Applying the correct electrical pulse sequence to the windings of the stepper motor results in a 1.8° step windings of the stepper motor results in a 1.8° step angle rotation of the spindle (i.e. 200 steps per angle rotation of the spindle (i.e. 200 steps per revolution). revolution).
Step AngleStep Angle
Step angle is the minimum degree of rotation Step angle is the minimum degree of rotation associated with a single stepassociated with a single step
To calculate: divide 360 by number of steps a motor To calculate: divide 360 by number of steps a motor takes to complete one revolution.takes to complete one revolution.
Stepper Motor rotating in full mode takes 4 steps to Stepper Motor rotating in full mode takes 4 steps to complete a revolutioncomplete a revolution
Step / Sec = RPM * Steps Per Revolution/60Step / Sec = RPM * Steps Per Revolution/60 So step angle can be calculated as...So step angle can be calculated as... Step Angle ø = 360° / 4 = 90°Step Angle ø = 360° / 4 = 90°
Basic Step Motor System
controller Driver Motor
DescriptionDescription
Controller will give output sequences Controller will give output sequences according to X_Y movement of mouse that according to X_Y movement of mouse that motor will follow. motor will follow.
Driver’s function is to control magnitude Driver’s function is to control magnitude and direction of current flow into the and direction of current flow into the motor windings.motor windings.
All step motor operate through the All step motor operate through the principle of the rotor following rotating principle of the rotor following rotating magnetic field created by sequencing the magnetic field created by sequencing the flow of current through stator windings.flow of current through stator windings.
Driver IC ULN2803Driver IC ULN2803
8-bit, 50V, 8-bit, 50V, 500mA ,TTL-input 500mA ,TTL-input NPN Darlington NPN Darlington driver. driver.
Current sinking.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…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 MotorsTwo Phase Stepper Motors Unipolar Stepper Motor:Unipolar Stepper Motor:
Five or six wires and four coils(actually two coils divided by center connection on each coil)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.Center connections of the coils used as the power connection. They are called unipolar steppers because power always comes in on this one pole.They are called unipolar steppers because power always comes in on this one pole.
Bipolar stepper motor:Bipolar stepper motor:
Four wires coming out of it.Four wires coming out of it. No comman center connection.No comman center connection. Two independent sets of coils. Two independent sets of coils.
))
Bipolar v/s Unipolar Unipolar• Simple driving circuit because no current reversal.Simple driving circuit because no current reversal.• Size comparatively larger for same specification as Size comparatively larger for same specification as
bipolar.bipolar.
BipolarBipolar Smaller sizeSmaller size Higher torqueHigher torque Complex driving circuit because current has to be Complex driving circuit because current has to be
reversereverse
.
main
Configure the 8 IO port pin as output
Configure IOPDATA for writing those port pin
AA
Out 66 on port pinsOut 66 on port pins
Initialise counter=0Initialise counter=0
Rotate the sequenceRotate the sequence
Apply it to port pinsApply it to port pins
AA
BB
CC
Is counter<4Is counter<4
stopstop
BB CC
NoNo
CONCLUSION & FUTURE CONCLUSION & FUTURE PLANPLAN
ACHIEVED RESULTACHIEVED RESULT
Input Interface:Input Interface: At input interface we got a error At input interface we got a error
command instead of command instead of acknowledgement command.acknowledgement command.
For getting acknowledgement For getting acknowledgement command we try to modify our code.command we try to modify our code.
But after modification we even But after modification we even couldn’t able to receive CLK from couldn’t able to receive CLK from mousemouse
Continue…Continue…
Output Interface:Output Interface: We were tried to interface stepper We were tried to interface stepper
motor to arm board & we were motor to arm board & we were generated only sequence for stepper generated only sequence for stepper motor. motor.
FUTURE PLANNINGFUTURE PLANNING
The arm board accept 3 Byte information The arm board accept 3 Byte information from mouse, that 3 Byte perform different from mouse, that 3 Byte perform different operation. operation.
We may add following features to our We may add following features to our project for controlling plotter Pen project for controlling plotter Pen movement by PS/2 mouse button.movement by PS/2 mouse button.
We will Provide following functionality to We will Provide following functionality to mouse buttons:mouse buttons:
1] Scaling key (LEFT BUTTON)1] Scaling key (LEFT BUTTON) 2] Pause key (RIGHT BUTTON)2] Pause key (RIGHT BUTTON) 3] Enter key (MIDDLE BUTTON)3] Enter key (MIDDLE BUTTON)
Continue…Continue…
In future we will try to sense the In future we will try to sense the button position value of PS/2 mouse.button position value of PS/2 mouse.
According to PS/2 mouse movement According to PS/2 mouse movement stepper motor will move in forward stepper motor will move in forward or in reverse direction. or in reverse direction.
Continue…Continue…
When Scaling key (Left Button) will be When Scaling key (Left Button) will be press ones ,pen will be raise & move to press ones ,pen will be raise & move to scaling point P1/ P2 on plotter, when again scaling point P1/ P2 on plotter, when again press pen is lower.press pen is lower.
When Pause key will be press execution of When Pause key will be press execution of program will be halt, by again pressing program will be halt, by again pressing key, program will be executed.key, program will be executed.
By pressing middle button scaling point By pressing middle button scaling point will be set. will be set.
CONCLUSIONCONCLUSION
This Project is very challenging, This Project is very challenging, interesting, motivating.interesting, motivating.
The actual objective of our Project is to The actual objective of our Project is to move the plotter according to X-Y position move the plotter according to X-Y position of PS/2 mouse. of PS/2 mouse.
But actual achievement in our project is But actual achievement in our project is input interface of the mouse with AX4510 input interface of the mouse with AX4510 Board.Board.
Continue…Continue…
We were implemented mouse We were implemented mouse initialization codeinitialization code
For output we were implemented For output we were implemented
software for stepper motor .software for stepper motor .
With the help of this we were trying With the help of this we were trying to generate the sequence of motor to generate the sequence of motor on LED & we got the sequence.on LED & we got the sequence.
THANK YOUTHANK YOU
QUERIESQUERIES
??