PS2 Controller Basics

First of all, lets see what a ps2 controller is made up of..

A normal controller consists of 16 hard buttons and 2 analog 2-axis encoders..

image courtesy: instructables
image courtesy: instructables
There is a chip inside which takes the data of these buttons and encoder…once a data byte is received in the chip of the remote, it has to receive a command from the master in order to send this byte…

the byte contains the information of the buttons which are pressed..

the wires of a ps2 remote are…

image courtesy: instructables
image courtesy: instructables
the communication between the master and the remote is done with the help of SPI (Serial peripheral interface)..so, the command is sent to the ps2 controller, and the controller sends the byte in return…

the first 3 command which are sent on command line are the configuration bytes…
nothing is returned in this process.. the ps2 is configured to send the next bytes..

after this, ps2 returns a byte for each command on command line..

first byte: D-Pad, Start, Stop, And analog “buttons”
second byte: L1,L2,R1,R2, circle, triangle, square, cross
third byte: joystick- Right x axis
fourth byte: joystick- Right y axis
fifth byte: joystick- left x axis
sixth byte: joystick- left y axis

so, the flow chart of the code (The complete code) goes like this:
image courtesy: instructables
image courtesy: instructables
I hope this was helpful to you..
Coming soon the tutorial for interfacing PS2 with AVR
Thank you!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s