Where are the good resources for using the PS2 dualshock controller with a uC? I'd like to know the meaning of things like controller id, controller status, etc. I have modified BS2 code from Nuts and Volts Issue 101 to work with a Nano 40 and a Pelican PL-6688 dualshock2 compatible controller. Miraculously, it works, but I want to know exactly what's going on. It appears to shift out a $01 for what is commented as a 'start' command. From there, a $42 is manually shifted out while shifting in the controller ID simultaneously. Shifting may be the wrong term, as it is just a For/next loop transferring a bit at a time. My understanding is that this is necessary because the DS2 controller starts transmitting before the uC is finished transmitting. What if I don't care about controller ID? Can I just shiftout $01, $42 then shiftin the data I want? From what I've gathered (which isn't much) the following information is true, but I still have more questions...
Sending $01 starts the communication from the controller to the uC
What is the purpose of sending $42 while retrieving the controller ID?
The code included with Studio has the following lines included. They seem to be similar in function as they all send a $01 followed by a $4#
Code:
shiftout PS2_CMD,PS2_CLK,LSBPRE,[$1\8,$43\8,$0\8,$1\8,$0\8] ;enter config mode
shiftout PS2_CMD, PS2_CLK, LSBPRE, [$01\8, $44\8, $00\8, $01\8, $03\8, $00\8, $00\8, $00\8, $00\8] ;set and lock analog mode
shiftout PS2_CMD, PS2_CLK, LSBPRE, [$01\8, $4D\8, $00\8, $00\8, $01\8, $FF\8, $FF\8, $FF\8, $FF\8] ;Enable Vibration motors
shiftout PS2_CMD, PS2_CLK, LSBPRE, [$01\8, $4F\8, $00\8, $FF\8, $FF\8, $03\8, $00\8, $00\8, $00\8] ;set 18byte reply
shiftout PS2_CMD, PS2_CLK, LSBPRE, [$01\8, $43\8, $00\8, $00\8, $5A\8, $5A\8, $5A\8, $5A\8, $5A\8] ;exit config mode
Are there more commands that can follow a 'start?' What is the information after the $4#? It's commented to tell me what the complete line does, but I'd like to know what each bit does, if anything. What data is in an 18 byte reply? I am only receiving 7 bytes after the manual shifting; controller status, left buttons, right buttons, Right JSX, Right JSY, Left JSX, Left JSY.
If controller ID is $73, its a DS1 controller (my Pelican returns $73 even though it says its a DS2 controller)
If controller ID is $79, its a DS2 controller
Are there other valid controller IDs?