Download presentation
Presentation is loading. Please wait.
Published byAldous Stevens Modified over 9 years ago
1
Playstation 2 Controller KYLE YAN AKSHAY MOORTHY YIPING KANG 1
2
Outline ◦PS2 Controller Components ◦Hardware Interface ◦Bytes and Packets Transfer Mechanism ◦Packet Structure ◦Frequently Used Commands ◦Example 2 http://www.walmart.com/ip/Sony-DualShock-2- PS2-Controller-Black-PlayStation-2/907869
3
Controller Components 2x Analog Sticks 16x Digital Buttons Two Vibration Motors 3 http://game-tips-etc.blogspot.com/2010/06/humble- ps2-controller.html
4
Buttons, Joysticks and Vibration Buttons ◦A tiny curved conduction strip attached to the bottom ◦More pressure -> More conductivity Joysticks ◦Two potentiometers below each joystick ◦Different angle -> Different resistance Vibration ◦Two spinning motors (one big, one small) ◦Controlled separately 4 http://www.dansdata.com/tmsticks.htm
5
Wiring 5 Brown - Data: MISO Orange - Command: MOSI Grey - Vibration motor power: 6-9 V Red - Power: 5 V. PS1 would work at 3.3V Yellow - Attention: Must be pulled low before each group of bytes is sent/received and set high afterwards Blue - Clock: Ranges from 100kHz to 500kHz, normally 500. Green - Ack: Normally high and drops low for 12 us after each byte for half a clock cycle. Open collector output.
6
6 Brown: data Master-in-slave-out 2008 CuriousInverter.com
7
7 Orange: command Master-out-slave-in 2008 CuriousInverter.com
8
8 Grey - Vibration motor power 2008 CuriousInverter.com
9
9
10
10 Red - Power: 5 V. PS1 would work at 3.3V 2008 CuriousInverter.com
11
11 Yellow - Attention: Must be pulled low before each group of bytes is sent/received and set high afterwards 2008 CuriousInverter.com
12
12 Blue - Clock: Ranges from 100kHz to 500kHz, normally 500. 2008 CuriousInverter.com
13
13 2008 CuriousInverter.com
14
14 Green - Acknowledge Normally high and drops low for 12 us after each byte for half a clock cycle. Open collector output. acknowledge 2008 CuriousInverter.com
15
How Bytes and Packets Are Transferred Playstation sends command at the same time it receives one data through serial communication Clock is held high until a byte is about to be send. Then it drops low to start a 8 cycles where command and data is simultaneously send and received. Reads occurs on rising edge of the clock. LSB is transferred first. 15
16
Sample Transaction 16 2008 CuriousInverter.com
17
Sample Transaction with Ack 17 2008 CuriousInverter.com
18
Sample Transaction with Attention 18 2008 CuriousInverter.com
19
Packet Structure Header is always first 3 bytes Most Common Commands 0x42 - Polling buttons 0x43 – Enter/Exit Config Mode 19 Byte #123 Command01Main Command00 DataFFDevice Mode5A Device Modes 0x4X – Digital Mode 0x7X – Analog Mode 0xFX – Config Mode
20
Main Polling Command (0x42) Get digital responses from buttons, also control the vibration motors. 20 Motors Control & Button Digital Output 2008 CuriousInverter.com
21
Button Mapping Byte 4 and 5 – Command/Mode dependent data Buttons are mapped to bytes 4 and 5 (active low) 21 2008 CuriousInverter.com
22
Main Polling Command (0x42) Get analog response from the joysticks and buttons 22 Analog Joystick Output (optional) Button Analog Output (optional) 2008 CuriousInverter.com
23
Enter/Exit Config Command (0x43) Config mode allows you to change multiple settings Command.4 0x01 Enter Config 0x00 Exit Config 23 2008 CuriousInverter.com
24
Switching Between Modes (0x44) Command = 0x44 Command.4 determines mode 0x00 – Analog Mode 0x01 – Digital Mode 24 2008 CuriousInverter.com
25
Other Config Commands Adding/Removing responses Vibration control Get more status info 25
26
Walkthrough Example 26 1.Enter config mode 2.Map motors to byte 4 and 5 3.Config the controller to return all values 4.Exit config mode 5.Main polling !
27
Walkthrough Example 27 1.Enter config mode 2.Map motors to byte 4 and 5 3.Config the controller to return all values 4.Exit config mode 5.Main polling ! 0x00 – small motor 0x01 – big motor Map byte 4 to big motor byte 5 to small motor
28
Walkthrough Example 28 1.Enter config mode 2.Map motors to byte 4 and 5 3.Config the controller to return all values 4.Exit config mode 5.Main polling ! Byte 4, byte 5 and the two LSB of byte 6 = 18 bits Corresponding to 18 bytes in data under main polling command ‘1’ indicates the response to be present in the data
29
Walkthrough Example 29 1.Enter config mode 2.Map motors to byte 4 and 5 3.Config the controller to return all values 4.Exit config mode 5.Main polling !
30
Walkthrough Example 30 1.Enter config mode 2.Map motors to byte 4 and 5 3.Config the controller to return all values 4.Exit config mode 5.Main polling ! Digital Analog Stick Button Pressure (Right fully pressed here) Motor Control
31
Reference Spinning Motor http://www.dansdata.com/tmsticks.htm Interfacing with a PS2 controller http://store.curiousinventor.com/guides/PS2/ http://www.lynxmotion.com/images/files/ps2cmd01.txt How buttons and joystick works http://www.howstuffworks.com/ps23.htm 31
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.