Interfacing with a Sony Playstation 2 Controller
I've seen some code for interfacing an older PS controller w/ a BS2.
Does anyone have any details to do the same with a PS2 & the SX?
I'm not looking to use any of the force feedback features. Just read the buttons and Joystick positions.
I'd even be interested in doing the same for any other game controllers. (XBox or Game Cube)
Thanks,
Jim Fouch
Does anyone have any details to do the same with a PS2 & the SX?
I'm not looking to use any of the force feedback features. Just read the buttons and Joystick positions.
I'd even be interested in doing the same for any other game controllers. (XBox or Game Cube)
Thanks,
Jim Fouch
Comments
I'm pretty sure the PSX and PS2 controllers·are interchangable. The only code I've seen for connecting a PSX controller to a BS/2 was a Nuts & Volts column located here: http://www.parallax.com/dl/docs/cols/nv/vol4/col/nv101.pdf
I'm going to guess thats probably what you saw also, if not you might want to check it out. I imagine you should be able to port the code using SX/B without too much difficultly.
This is some good info. Basically, I'm looking for·a quick & cheap way to control my camera & mount for video recording. Controllers can be picked up for $10 or so and a few dollars more to interface it with an SX.· :-)
If that thread does nothing for you·might want to consider·something else. It would involve a bit of work, but you could take one of those $10 controllers and rip the thumbsticks out and use them with a few cheap pushbuttons to make you own custome controller. If you're clever enough, you could use the original controller housing and just build a new circuit board to put inside it. That would eliminate the need to build an interface since you would be wiring the thumbsticks and the pushbuttons directly to the SX. That would·cut down on the coding quite a bit. Heck, if·theres enough room inside the controller housing you could go all out and make it battery powered and use an IR or RF interface to control everything.
I'm looking at interfacing also to a JVC camera too. It also uses an IR control. I don't have the JVC yet, but I hope it uses the same 38Khz or 40Khz carrier signal.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
That would be AWESOME!!!
Please post it in the main forum....or better yet, add me to a mailing list when it is done...I have a ton of projects that would benefit from using a PSX controller...
Thanks!
cbmeeks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://metroidclassic.com
=========
DMCA Sucks
RIAA Sucks
It sounds like you're looking for code to control the SX, but if you're interested/willing to roll your own, here's a page with all the tech specs on PSX controllers:
www.gamesx.com/controldata/psxcont/psxcont.htm
Thanks, PeterM
Has anyone else ever done a wireless one?
Once I get my code looking nice, I'll post what I have so far.
I'm also making a DLL that will read from the SX's serial port all the readings from the PS2 controller. This will allow easy intergration with VB or any ActiveX aware software. Right now I have my readings down to about 2ms.
Jim
Did anyone ever win the Basic Stamp in the contest to get force feedback working? (September 2003 Stamp Applications)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
SX-Key + SX52 + Proto Board + SX-Key Software + Computer + USB to Serial Adapter + LED = Blinky LED!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jim Fouch) : 11/19/2005 11:30:59 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
If you use the samples from the web it will report back just like they say. But, if you hook a scope to a PS2 that's talking to a controller, you will see that the PS2 will have a longer conversation with the controller. It's like 21 bytes in length. Starting With Byte Zero being the PS2 sending a $01, the Controller (Both that I have tried) will send back the normal info, then starting with the 8th byte it will send the pressure (how hard you are pressing the buttons) for each button!!!! There are 12 extra bytes send. Each being a value from 0-255. This seems to only work when the controller is in the digital mode.
It was like finding GOLD. I didn't know the controllers even had sensors for how hard you were pressing the buttons.
Jim
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jon Williams (Parallax)) : 11/20/2005 12:00:02 AM GMT
FYI - ony PS2 controllers can measure the pressure of each button. That's one of the most useful things to come out of a Best Buy video game department salesman.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
SX-Key + SX52 + Proto Board + SX-Key Software + Computer + USB to Serial Adapter + LED = Blinky LED!
My code can read the mode, buttons and joysticks, and it can set both rumble motors. The problem with setting rumble motors is that the PS2 controller clocks the button bytes out at the same time it clocks the motor control bytes in. Consequently, you must read the buttons with one request, and then set the motors and read the joysticks with another request.
I have tried to read pressure values from the buttons but have not been successful.
The code works for cord controllers that I have tried, but did not work for a LogiTech cordless. I just ordered a Madcatz cordless to try based on several posts at Lynxmotion.
My goal is a cheap short range radio for 1/6 scale RC paint ball tank combat www.rctankcombat.com
I can provide Atom code if you wish.
Yes please post that code. I'd love to see it, and I'm sure Jon Williams will too.
Thanks. And Welcome to the Forums.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module" Now available from Parallax for only·$49.95
http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
Those that would give up freedom for security will have neither.
·
You'll see there's a subroutine called PSX_SHIFTIO that can send and receive data at the same time.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jon Williams (Parallax)) : 12/6/2005 12:58:03 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I watch how the moon sits in the sky on a dark night,
shining with the light from the sun,
The sun doesn't give light to the moon,
Assuming the moons gonna owe it one,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I watch how the moon sits in the sky on a dark night,
shining with the light from the sun,
The sun doesn't give light to the moon,
Assuming the moons gonna owe it one,
Joe
' {$STAMP BS2}
' {$PBASIC 2.5}
psxThumbL VAR Byte ' left thumb buttons
psxThumbR VAR Byte ' right thumb buttons
psxJoyRX VAR Byte ' r joystick - X axis
psxJoyRY VAR Byte ' r joystick - Y axis
psxJoyLX VAR Byte ' l joystick - X axis
psxJoyLY VAR Byte ' l joystick - Y axis
idx VAR Nib
tmpout VAR Byte
PsxAtt PIN 9 ' PSX joystick interface
PsxClk PIN 8
PsxCmd PIN 10
PsxDat PIN 11
MAIN:
DO
GOSUB Get_PSX_Buttons
DEBUG HOME, BIN8 psxThumbL," ",BIN8 psxThumbR," ",CR'HEX2 psxID," ",HEX2 psxSta,CR
DEBUG "psxJoyRX = ",DEC3 psxJoyRX ,CR
DEBUG "psxJoyRY = ",DEC3 psxJoyRY ,CR
DEBUG "psxJoyLX = ",DEC3 psxJoyLX ,CR
DEBUG "psxJoyLY = ",DEC3 psxJoyLY ,CR
LOOP
'
[noparse][[/noparse] Subroutines ]
Get_PSX_Buttons:' This routine REQUIRES inverted clock signal from
DIR10=1
DIR11=0
LOW PsxClk
LOW PsxAtt
'GOTO test
'request data
tmpout=$01
FOR idx=0 TO 7
PsxCmd=tmpout.LOWBIT(idx)
PULSOUT PsxClk,2
NEXT
PAUSE 1
tmpout=$42
FOR idx=0 TO 7
PsxCmd=tmpout.LOWBIT(idx)
PULSOUT PsxClk,2
NEXT
PAUSE 1
tmpout=$00
FOR idx=0 TO 7
PsxCmd=tmpout.LOWBIT(idx)
PULSOUT PsxClk,2
NEXT
PAUSE 1
FOR idx=0 TO 7
psxThumbL.LOWBIT(idx)=PsxDat
PULSOUT PsxClk,1
NEXT
FOR idx=0 TO 7
psxThumbR.LOWBIT(idx)=PsxDat
PULSOUT PsxClk,1
NEXT
FOR idx=0 TO 7
psxJoyRX.LOWBIT(idx)=PsxDat
PULSOUT PsxClk,1
NEXT
FOR idx=0 TO 7
psxJoyRY.LOWBIT(idx)=PsxDat
PULSOUT PsxClk,1
NEXT
FOR idx=0 TO 7
psxJoyLX.LOWBIT(idx)=PsxDat
PULSOUT PsxClk,1
NEXT
FOR idx=0 TO 7
psxJoyLY.LOWBIT(idx)=PsxDat
PULSOUT PsxClk,1
NEXT
HIGH PsxAtt
RETURN
END
Thanks