Shop OBEX P1 Docs P2 Docs Learn Events
Playstation Controller Hex Values. — Parallax Forums

Playstation Controller Hex Values.

Paul K.Paul K. Posts: 150
edited 2012-04-30 09:14 in Robotics
I use PS2 controllers in some of my projects and have mapped the hex values for all the button combinations.
Thought others may find this useful.
I made a small spreadsheet with the all the possible values for a PS2 controller.

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-04-29 20:09
    Paul,

    I've been working on a robot remote using a PS2 controller. (I've delayed most of my robot projects until I get it done.)

    I've also been recently studying the PlayStation 2 data.

    I think you're referring to the wrong set of data here.

    attachment.php?attachmentid=92110&d=1335754592

    The value $5A is actual information about the controller. I think all normal PlayStation 2 controllers use this same code.

    the value $73 is information about the mode the controller is in and how many words of data after the header the controller is sending.

    The nibble $7 indicates its in analog mode. A $4 here indicates digital mode and $F indicates config mode.

    The nibble $3 indicates there are three 16-bit words of data being transmitted. Both the PS2 objects I've tried actually return the bytes within in a group of four in reverse order so the first word returned is the $FFFF that proceeds the $5A73. As you indicated, this word of data contains button state information. Each bit contains the state of one button. A zero indicates a button press and a one indicates it's not pressed.

    The long of data following this initial long contains the joystick data.

    12 of the buttons can also be read in analog button mode where a value of 0 to $FF is returned to indicate the about of pressure on each button. When the analog buttons are turned on, the header is no longer $5A73 but $5A79, to show that nine words of data are being transmitted. The additional six words contain the button pressure information.

    I recently posted an object that reads this analog button information. Here's a link to the thread where I posted it.

    I've been trying to figure out how to use the analog button information to enhance control of a hexapod. I haven't come up with anything yet.
    439 x 317 - 14K
    Ps2.PNG 14.3K
  • Paul K.Paul K. Posts: 150
    edited 2012-04-29 21:26
    Yup your right Duane, I used the PS2_Controller object and it clearly says the same thing. The hex string used above is only for the buttons and modes.

    The above xls sheet will work for the button values.
    There is a typo for the select button. It should be $FFFE5A73 as well.
    I'll post a new xls file with the changes.
  • ercoerco Posts: 20,255
    edited 2012-04-30 09:14
    Kudos to Paul_K, Duane (hi hi hi), and all those pushing the controller envelope.

    Judging from the many PS2, iPhone and Xbee control posts, I must be the last guy who thinks basic IR control is still pretty cool for a small robot. :)

    If nothing else, IR is cheap, fully worked out & well-documented. A buck for an IR sensor, a buck for a universal remote at the dollar store, and a quick copy & paste of the read_IR code!
Sign In or Register to comment.