Hex codes for vibration of ps controller

HI
I’m new in this forum. I controlled the ps2 controller with pic16f628a. Firsty I send 0x01 then 0x42, 0xff and I received 0xff,0x41,0x5A .(This shows that the controller is worked.)
I wanted to know ‘How works the vibration of ps1/2 controller?’ Which codes required for it?
Could you help me?
(Sorry for my mistakes. Because I don’t know english very well…)

Hey, this should help you out:

lynxmotion.com/images/html/build034.htm

Look at step 3. Laurent Gay wrote some nice code for the Basic Atom on how to make the motors vibrate based on button pressing. There are a ton of comments!

 ;-----------PS2 Vibration motors----------
Small_Motor = 1 - Temp(1).bit5 ; Numeric right arrow button (Small Motor on/off)
Large_Motor = Temp(8) ; Analog left arrow button (Large Motor speed)

low SEL
; asking data to PS2 controller (again)
; sending at the same time the vibration motors speed to perform
; (using the previously read analog buttons position ( <- : large motor, -> : small motor )
; the more you press on these buttons, the more the corresponding motor vibrates fast
; some wireless PS2 controllers react only to the large motor command and some have no motor at all.
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8,$0\8,Small_Motor\8,Large_Motor\8]
; we don't care about reading the data from the controller here.
; so, why not use this to read PS2 data the first time? because it's not working:
; as the PS2 controller is starting to send data just after receiving the
; "shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8..."<------here
; and as we are sending after that some data for motors "... ,$0\8,temp(7)\8,temp(8)\8]"
; it's now too late to read all the data from the PS2 controller
; because there's already some bytes sent by it and lost (no buffer here).
high SEL
;-----------------------------

Code of interested I believe.

Looks like you first set SEL to low
send a 0x01
then a 0x42
then a 0x00
then the small motor
and large motor
then set SEL to high.

Hope it helps :slight_smile:

-robodude666

Thank you robodude666.
I’ll apply this codes to the controller. I’ll again tell you results.

Alright, no problem.

How are you controlling the PS2 controller with the PIC? I2C? SPI? Parallel? :S

Some pics have special ports for sychron communation.(USART or SPI)
Forexample; pic16f877 and pic16f628(this has not SPI only USART)
We know that the ps controller is communated as full duplex communation.
(full duplex communation: you can send data and receive data in the same time.)
But I didn’t use SPI or USART.
I did it using software with temproray shift registers. Forexample; I loaded 0xff to DATA_OUT register
(this is 1byte and variable) And I first send LSB to command pin which is I determined .
Then I rotated DATA_OUT to right.This is continued for 8 bits. When data comes we can do same operation;Write first bit to the DATA_IN then rotate the tamprorary register to left.
Again this is continued for 8 bits. Then you can use DATA_IN for your aims.

So your using USART? Alright, thanks.

Actually it sounds more like he bit-banged it rather than use the built in hardware.
You should be able to use an SPI port in any micro. You need to manage the chip select manually (the SEL signal) but that’s simple enough, just set it before you write/read from the SPI port and clear it when the port is no longer busy.

I tried the codes which you send me. But the controller not respond.
May be I have a time delaying problem. In the program there is a command
which is** PAUSE 1 **or PAUSE 100. Does this command provide micro second
or mili second time delaying? (I used micro second)
Or, have the ps controllers different configurasyon bytes? Can it change
from one to another ps controller? (I’m using a controller that, it has
two output cables which are usb and ps1/2 output.And double vibration)

Aren’t there any answers?

Kazim it is not clear how much effort the members of this forum have spent making the force feedback function. while it is of interest this is not the typical application for our purpose. while I understand the basic means by which the controller communicates I do not know the specifics of timing. you may need to research this further using google or yahoo on the internet. I believe several here would be interested to see what you discover.

I look at the google and I found the mean of PAUSE. It provides microsecond time delaying which I guessed.
I wanted to ask a question?
I’m using PACITECH controller for PS1/2 and computer. Are this controller’s configuration bytes differrent from original PS controllers?

It seems that if it works with a PS2 console that your controller should have the same basic command set as an actual sony PS2 controller. It could be more or less strict in its timing requirements though so this is unknown. Any chance you have the actual PS2 console + controller and an oscilloscope where you could watch the signals between the PS2 and the controller to determine the exact timings used? If you don’t have this at home perhaps a school or electronics repair shop might be able to help. Just suggesting ideas here as I do not know much more to help.

PS controllers work at slave mode. In another word; It works with my CLOCK pulses. I designate the pulse width. So, the signal doesn’t matter.
My controller is works succesfully when I don’t apply the configuration bytes which are above. I think prblem may result from config. bytes.

Vibration is working successfully. My mistake was very simple. In the codes which you send me ‘there is a note.’ It says that the cable’s color (for activating vibration) is green which is 9 volts. But in my controller this color is gray and green cable’s color is for ACK.
Thanks robodude666, **EddieB ** and to the everybody who wanted to help me.