PS2 viberation not working

Hello, I just got my MadCat wireless controller yesterday and was trying to try it out with this program. However, I’ve made sure that everything is connected and still the viberation motors aren’t working.
The controller i’m using the PS2 madcat wireless (the one advaible on this site).

[code];************************************************
;*** Basic Atom with SSC-32 and PS2 DualShock ***
;* H2 program #2 : Tank move + 1 joystick move *
;********** Bot Board Buzzer support ************
;************************************************
;** Programmer: Laurent Gay, [email protected] **
;************************************************
;
; Control Mode 1 :
; Control the right legs with the right joystick (SSC-32 XR command)
; Control the left legs with the left joystick (SSC-32 XL command)
; the global speed is mixed (SSC-32 XS command)
;
; Push the R3 button (Right joystick push button) to swap between control modes
;
; Control Mode 2 :
; Control All legs with the right joystick (SSC-32 XR-XL command mixed)
; the global speed is mixed too (SSC-32 XS command)
;
; Right and Left buttons adjust the speed limit (Mode 1 & 2)
;
; you may have to push the Analog Button on a MadCatz Wireless controller (if in sleep mode)
;
;************************************************
;
;
;--------------------------------------------------------------------
;-------------Constants
;PS2 Controller / BotBoard I
'DAT con P4
'CMD con P5
'SEL con P6
'CLK con P7
'SSC32 con p15
;PS2 Controller / BotBoard II
DAT con P12
CMD con P13
SEL con P14
CLK con P15
SSC32 con p8

DeadZone con 28 ; must be >= 28
PadMode con $79 ; Dualshock2 mode, use $73 with a Dualshock1

;--------------------------------------------------------------------
;-------------Variables
index var Byte
DualShock var Byte(7)
LastButton var Byte
XR var SWord
XL var SWord
MoveModeH2 var Bit
Speed var Byte
MaxSpeed var Byte

YCoord var Sbyte
ZCoord var Sbyte
WCoord var Sbyte

;--------------------------------------------------------------------
;***************
;*** Program ***
;***************

;-------------Init
;DualShock
pause 500

clear
high CLK

again
low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$43\8,$0\8,$1\8,$0\8] ;CONFIG_MODE_ENTER
high SEL
pause 1

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$44\8,$00\8,$01\8,$03\8,$00\8,$00\8,$00\8,$00\8] ;SET_MODE_AND_LOCK
high SEL
pause 100

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$4F\8,$00\8,$FF\8,$FF\8,$03\8,$00\8,$00\8,$00\8] ;SET_DS2_NATIVE_MODE
high SEL
pause 1

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$43\8,$00\8,$00\8,$5A\8,$5A\8,$5A\8,$5A\8,$5A\8] ;CONFIG_MODE_EXIT_DS2_NATIVE
high SEL
pause 1

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$43\8,$00\8,$00\8,$00\8,$00\8,$00\8,$00\8,$00\8] ;CONFIG_MODE_EXIT
high SEL
pause 1

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8]
shiftin DAT,CLK,FASTLSBPOST,[DualShock(0)\8]
high SEL
pause 1

;serout S_OUT,i57600,"PadMode : ", HEX2 DualShock(0), 13]
Sound 9,[100\4435]
if DualShock(0) <> PadMode then again

MoveModeH2 = 0
MaxSpeed = 100
LastButton(0) = 255

;SSC-32 -> H2 engine
pause 500
serout SSC32,i38400,[13] ;clear the SSC-32 buffers
;Servo Offset Command
;Replace the section between the quotes with the values as described in the tutorial.
;serout SSC32,i38400,"#0PO0 #1PO0 #2PO0 #3PO0 #4PO0 #5PO0 #16PO0 #17PO0 #18PO0 #19PO0 #20PO0 #21PO0",13]

serout SSC32,i38400,“XS0 XSTOP”,13] ;Stop the sequencer if running
serout SSC32,i38400,“LF1700 RF1300 LR1300 RR1700”,13] ;Horizontal
serout SSC32,i38400,“LH1000 LM1900 LL2000”,13] ;Vertical Left
serout SSC32,i38400,“RH2000 RM1100 RL1000”,13] ;Vertical Right
serout SSC32,i38400,“VS2500 HT500”,13] ;Vertical Speed and Horizontal Time
serout SSC32,i38400,“XS0”,13] ;Set Global Speed to 0

;--------------------------------------------------------------------
;-------------Main loop
main
;DS2
low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8]
for index = 0 to 6
shiftin DAT,CLK,FASTLSBPOST,[DualShock(index)\8]
next
high SEL

YCoord = DualShock(6) - 128
if YCoord > DeadZone then
	YCoord = YCoord - DeadZone
elseif YCoord < -DeadZone
	YCoord = YCoord + DeadZone
else
	YCoord = 0 
endif

ZCoord = DualShock(3) - 128
if ZCoord > DeadZone then
	ZCoord = ZCoord - DeadZone
elseif ZCoord < -DeadZone
	ZCoord = ZCoord + DeadZone
else
	ZCoord = 0 
endif

WCoord = DualShock(4) - 128
if WCoord > DeadZone then
	WCoord = WCoord - DeadZone
elseif WCoord < -DeadZone
	WCoord = WCoord + DeadZone
else
	WCoord = 0 
endif

if (DualShock(1).bit2 = 0) and LastButton.bit2 then ;R3 Button test
	MoveModeH2 = MoveModeH2 ^ 1
	Sound 9,[100\1318]
endif

if (DualShock(1).bit5 = 0) and (MaxSpeed <= 190) then	;Right Button test
	MaxSpeed = MaxSpeed + 10
elseif (DualShock(1).bit7 = 0) and (MaxSpeed >= 20)		;Left Button test
	MaxSpeed = MaxSpeed - 10
else
	goto NoSound1
endif
Sound 9,[100\(MaxSpeed * 10 + 100)]

NoSound1
if MoveModeH2 then ;One Joystick Mode
XR = -ZCoord - WCoord
XL = ZCoord - WCoord

	if XR > 100 then
		XR = 100
	elseif XR < -100
		XR = -100
	endif
	
	if XL > 100 then
		XL = 100
	elseif XL < -100
		XL = -100
	endif
	
	if abs(WCoord) > abs(ZCoord) then
		Speed = abs(WCoord) * MaxSpeed / 100
	else
		Speed = abs(ZCoord) * MaxSpeed / 100
	endif
else				;Tank Mode 
	if abs(WCoord) > abs(YCoord) then
		Speed = abs(WCoord) * MaxSpeed / 100
	else
		Speed = abs(YCoord) * MaxSpeed / 100
	endif	
	XR = -WCoord
	XL = -YCoord
endif

serout SSC32,i38400,"XS",DEC Speed," XR",SDEC XR," XL",SDEC XL,13]

LastButton = DualShock(1)

nap 2 ;internal sleep mode, approx 38ms, use value 3,4 or 5 with some slow wireless controller

goto main

[/code]

Try it on a PS2 game console to see if works there. If yes, then you can start looking into the code. If no, then the controller may be defective. Quick test can save you hours of troubleshooting.

yes the viberation works fine on my ps2. I haven’t figured out all the where-a-bouts on your code, but can someone post some (code) that will just run the viberation motors?

Bane

Nope, still no viberation. I used this code here.

Just a thought

But is says “not required for the lynxmotion one” and thats the one i have.

[code];-----------Bot Board Selection----------
;PS2 Controller / BotBoard I
;DAT con P4
;CMD con P5
;SEL con P6
;CLK con P7

;PS2 Controller / BotBoard II
DAT con P12
CMD con P13
SEL con P14
CLK con P15
;-----------------------------

index var byte
temp var byte(19)
mode var byte
Small_Motor var byte
Large_Motor var byte

;PS2Init
high CLK

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$43\8,$0\8,$1\8,$0\8] ;CONFIG_MODE_ENTER
high SEL
pause 1

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$44\8,$00\8,$01\8,$03\8,$00\8,$00\8,$00\8,$00\8] ;SET_MODE_AND_LOCK
high SEL
pause 100

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$4F\8,$00\8,$FF\8,$FF\8,$03\8,$00\8,$00\8,$00\8] ;SET_DS2_NATIVE_MODE
high SEL
pause 1

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$4D\8,$00\8,$00\8,$01\8,$FF\8,$FF\8,$FF\8,$FF\8] ;VIBRATION_ENABLE
high SEL
pause 1

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$43\8,$00\8,$00\8,$5A\8,$5A\8,$5A\8,$5A\8,$5A\8] ;CONFIG_MODE_EXIT_DS2_NATIVE
high SEL
pause 1

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$43\8,$00\8,$00\8,$00\8,$00\8,$00\8,$00\8,$00\8] ;CONFIG_MODE_EXIT
high SEL
pause 1

main

;-----------PS2 Mode----------
low SEL
; asking “mode” to PS2 controller
shiftout CMD,CLK,FASTLSBPRE,$1\8]
; reading “mode” from PS2 controller
; 73(hex) is dualshock1 (digital buttons)
; 79(hex) is dualshock2 (analog buttons)
shiftin DAT,CLK,FASTLSBPOST,[mode\8]
high SEL
;-----------------------------

pause 1

;-----------PS2 Data----------
low SEL
; asking data to PS2 controller
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8]
; reading data from controller
; (don’t use a “for-next” loop, it’s too slow to read PS2 data)
shiftin DAT,CLK,FASTLSBPOST,[temp(0)\8,temp(1)\8,temp(2)\8,temp(3)\8,temp(4)\8,temp(5)\8,temp(6)\8,temp(7)\8,temp(8)\8, |
temp(9)\8,temp(10)\8,temp(11)\8,temp(12)\8,temp(13)\8,temp(14)\8,temp(15)\8,temp(16)\8,temp(17)\8,temp(18)\8]
high SEL
;-----------------------------

pause 1

;-----------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
;-----------------------------

;-----------Basic Micro IDE terminal----------
; sending carriage return (CR = 13) and the PS2 mode(hex) to the PC
serout S_OUT,i57600,[13, hex2 mode\2] ; Basic Micro IDE <= 02.2.1.1
'serout S_OUT,I8N1_57600,[13, hex2 mode\2] ; Basic Micro IDE <= 05.3.0.0
;serout S_OUT,i57600,[13, hex2 mode\2] ; Basic Micro Pro IDE <= 08.0.1.7

for index = 1 to 18 ; temp(0) contains a dummy variable so we don’t send it to the PC
; sending all the data to the PC
serout S_OUT,i57600," “, dec3 temp(index)\3] ; Basic Micro IDE <= 02.2.1.1
'serout S_OUT,I8N1_57600,” “, dec3 temp(index)\3] ; Basic Micro IDE <= 05.3.0.0
;serout S_OUT,i57600,” ", dec3 temp(index)\3] ; Basic Micro Pro IDE <= 08.0.1.7
next
;-----------------------------

goto main[/code]

Your first post says you are using a madcatz controller and now you are saying you are using a lynxmotion controller, so which is it. :wink:

I thought that the lynmotion controller was made by Madcatz. (Ok, i must have come up with that on my own digit :blush: )
(just added this in) here it is

But regardless, i’m using the lynxmotion controller advaliable on this website.

Can you post some simple code that will make the viberation motors work so i can see if my controller is fully functional? Everything else works great.

Bane

I was hesitant to get involved with helping you troubleshoot a madcatz controller. :wink:

time elapsed…

Ok I have good news and bad news.

The bad news is it doesn’t work on my testing here either.

The good news is I will ask Laurent to look into it.

Yes!! For once i’m not going insane! (i’ve tried alot of things)

I’ll be looking forward to your research. :smiley:

bane

Hello Bane,

I have tried all code modifications i can think of…with no positive result :cry:
sorry for this issue :unamused: :blush:

Hmm, thats interesting :confused: . Do you know if enabling the viberation motors is even possible with the lynxmotion controller? Just out of curiosity, was this tutorial ever done by anyone else that had trouble. I find this odd being that all the other tutorials haven’t gave me any trouble :frowning: .

Bane

This remains a mystery to me. Both Laurent and I thought this worked in the past. It’s possible that the second batch of controllers we received didn’t have this feature, but it’s really difficult to nail down. We are still working on it.

Are there any modifications made to this controller?

bane

No modifications, it’s a genuine imitation PS2 games controller. 8)

Do you mean that you made the tutorial on a different brand controller? If so…that sux, i had a great idea for a robot.
:cry:
Bane

Yes the original code was written for the MadCatz controller and also verified with the Sony brand one. I am working with the mfg to get some help. I don’t know if we will be successful but we are trying.

Sony will never release any code examples for the controllers. All of the code commands we are using were found on the internet a long time ago. They were posted by people who have attempted to reverse engineer it. We continue to fine tune and further modified the code to fix inaccuracies.

Because the motors work on the PS2 console then it’s just a matter of fine tuning our code to make it work. This is easier said then done.

any luck?

is there anything i can do to help?

Bane

Nothing yet. With the language barrier, the competition, the Sony factor… I will prod them again.

question: why do you have the green connected to VS in this picture? http://www.lynxmotion.com/images/assembly/eh3rv2/big/eh3r12b.jpg

Can i get a controller that will work or should i hunt for one of those good old controlles :wink: .

Bane

The green wire is used on some controllers for the vibrating motors. However on the Lynxmotion ones the wire is not used.

Over the week end i got the viberation motors to work with this code:

However, i can’t get control of any bottons or the d pad. Only have limited control of right and left joys.

[code]DAT con P4
CMD con P5
CLK con P7
SEL con P6

temp1 var byte
index var byte
temp var byte(21)
cntr var byte
mode var byte

small var byte
large var byte

high CLK

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$43\8,$0\8,$1\8,$0\8] ;Config Enable
high SEL

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$44\8,$00\8,$01\8,$03\8,$00\8,$00\8,$00\8,$00\8] ;Set Mode and Fix(Analog
high SEL

pause 100

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$4D\8,$00\8,$00\8,$01\8,$ff\8,$ff\8,$ff\8,$ff\8] ;Vibration Enable
high SEL

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$43\8,$00\8,$00\8,$00\8,$00\8,$00\8,$00\8,$00\8] ;Config Exit
high SEL

main

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8]
shiftin DAT,CLK,FASTLSBPOST,[mode\8]
high SEL

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8]
for index = 0 to 2
shiftin DAT,CLK,FASTLSBPOST,[temp(index)\8]
next
high SEL

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8,$0\8,large\8,small\8]
for index = 3 to 6
shiftin DAT,CLK,FASTLSBPOST,[temp(index)\8]
next
high SEL

serout S_OUT,i57600,[13,hex2 mode\2]
for index = 1 to 6
serout S_OUT,i57600," ",dec3 temp(index)\3]
next

small = temp(7)
large = temp(8)
goto main[/code]

please help, i’ve tried a lot of things and i just can’t seem to get viberation and full control all at once!

Bane