Shop OBEX P1 Docs P2 Docs Learn Events
PS2 Wireless Gamepad works with BS2 - Heres how - Page 2 — Parallax Forums

PS2 Wireless Gamepad works with BS2 - Heres how

245

Comments

  • aridaiosaridaios Posts: 57
    edited 2006-08-06 08:04
    1.·I use the very first code.
    2. I am not using Pin 3.·I will try connecting is to 9v.
    3. I can not put the wireless controller into analog mode.Is there any way to put it·through code?

    michael
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-06 08:08
    aradios,
    please note that I added this to the init section:
    PAUSE 250 'give controller time to initialize··


    if you do not see it refresh your browser.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-06 08:11
    Your analog button isn't working on either controller?? Make sure your controller is on and on channel before starting up the BS2 so the analog command is sent. Oh if you haven't noticed I edited my previous reponse and posted the analog code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun
  • aridaiosaridaios Posts: 57
    edited 2006-08-06 12:13
    ·I used your last version of code.
    Now my controller locks to analog mode(green light is on),not every time, but still can't understand any joystick movement when locked.

    michael
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-06 15:48
    Increase the Pause 250 to Pause 500 - It should happen every time as long as the joysticks is on first.
    What does the debug monitor screen say?

    11111111 11111111
    255 255
    255 255

    or somehting closer to this:

    11111111 111111
    128 127
    126 128

    does pressing the Square button pad give you this:

    11111111 01111111
    (ignore the rest for now )

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-06 16:12
    Oh yeah, I forgot to ask - could you post a schemtic please?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • aridaiosaridaios Posts: 57
    edited 2006-08-06 16:46
    The debug window shows the following

    11111111 11111111
    255 255
    255 255
    I use the schematic of J. Williams article.

    Michael
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-06 16:55
    Is that when you press the square button?
    Is your joystick going into analog mode everytime with the pause 500?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • aridaiosaridaios Posts: 57
    edited 2006-08-06 18:19
    Yes, it is·going into analog mode everytime with the pause 500.
    Pressing the Square button does nothing.
    I always see the following

    11111110 11111111
    001·001
    001·001

    Michael
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-06 20:39
    Well thisit's what it's telling me so far

    1.The program is communicating with the reciever - that's why it's setting analog mode.
    2. the 11111110 in the first byte would indicate the "Select" button being pushed - I assuming it's not?
    3. the 001's usually mean that all the joysticks are to the left and up, again I'm assuming it's not.
    Try the controller on the Playstation just to check that the batteries are OK. That 001 also shows me that you are receiving data from the Receiver since you are using pull-up resistors.

    try changing the Get_PSX_Buttons routine timing to this

    PULSOUT PsxClk,1 'this will change the clock to 2 microseconds

    leave the BitSend routine alone it seems to be working fine.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • aridaiosaridaios Posts: 57
    edited 2006-08-06 21:34
    1. Yes, I think it is.
    2. it's not. It happens the same even with a wired controller attached.
    3. it's not.
    · Batteries are OK.

    I· changed the Get_PSX_Buttons routine timing to PULSOUT PsxClk,1 .
    Nothing happened

    michael
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-06 22:09
    1.Is the 7.6V wire connector pin #3 energized? form the Vin is fine

    Can you copy and paste the code exactly as it appears in your BS2. Her's why:

    The strange part is that the controller simultaneously outputs data as it inputs therefore it should be writing if its reading. The code is designed to output zeros to retieve the data (by the way if we change the zeros to numbers that activates forced feedback.)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR

    Post Edited (TechnoRobbo) : 8/6/2006 10:15:06 PM GMT
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-06 23:19
    Try this - theres some extra init codes that have absolutely no effect on the Pelican but may have on the others. Namely DS2 Native Mode. I added a delay in the Main loop just to give the controller some breathing room to process. Again - not necessary on the Pelican.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}


    'i/o config


    buff VAR Byte(6)

    PsxAtt PIN 9 ' PSX joystick interface
    PsxClk PIN 8
    PsxCmd PIN 10
    PsxDat PIN 11

    tmpout VAR BYTE
    idx VAR NIB
    idy VAR NIB



    'inits
    PAUSE 250 'give controller time to initialize
    OUTPUT PsxCmd
    INPUT PsxDat
    LOW PsxClk
    LOW PsxAtt
    FOR idy = 0 TO 8
    LOOKUP idy,[noparse][[/noparse]$01,$43,$00,$01,$00,$00,$00,$00,$00],tmpout
    GOSUB BitSend
    NEXT
    HIGH PsxAtt
    PAUSE 1

    LOW PsxAtt
    FOR idy = 0 TO 8
    LOOKUP idy,[noparse][[/noparse]$01,$44,$00,$01,$03,$00,$00,$00,$00],tmpout
    GOSUB BitSend
    NEXT
    HIGH PsxAtt
    PAUSE 1

    LOW PsxAtt
    FOR idy = 0 TO 8
    LOOKUP idy,[noparse][[/noparse]$01,$4F,$00,$FF,$FF,$03,$00,$00,$00],tmpout
    GOSUB BitSend
    NEXT
    HIGH PsxAtt
    PAUSE 1

    LOW PsxAtt
    FOR idy = 0 TO 8
    LOOKUP idy,[noparse][[/noparse]$01,$43,$00,$00,$5A,$5A,$5A,$5A,$5A],tmpout
    GOSUB BitSend
    NEXT
    HIGH PsxAtt
    PAUSE 1


    LOW PsxAtt
    FOR idy = 0 TO 8
    LOOKUP idy,[noparse][[/noparse]$01,$43,$00,$00,$00,$00,$00,$00,$00],tmpout
    GOSUB BitSend
    NEXT
    HIGH PsxAtt
    PAUSE 1

    '[noparse][[/noparse]$01,$43,$00,$01,$00,$00,$00,$00,$00]'config mode enter
    '[noparse][[/noparse]$01,$44,$00,$01,$03,$00,$00,$00,$00]'set analog
    '[noparse][[/noparse]$01,$4D,$00,$00,$01,$ff,$ff,$ff,$ff]'Vibration Enable
    '[noparse][[/noparse]$01,$4F,$00,$FF,$FF,$03,$00,$00,$00]'Set Native Mode
    '[noparse][[/noparse]$01,$43,$00,$00,$5A,$5A,$5A,$5A,$5A]'EXIT DS2 NATIVE
    '[noparse][[/noparse]$01,$43,$00,$00,$00,$00,$00,$00,$00],'config mode exit

    'program

    MAIN:
    DO
    GOSUB Get_PSX_Buttons
    DEBUG HOME,BIN8 buff(0)," ",BIN8 buff(1) ,CR
    DEBUG DEC3 buff(2)," ",DEC3 buff(3) ,CR
    DEBUG DEC3 buff(4)," ",DEC3 buff(5) ,CR
    PAUSE 16
    LOOP

    '
    [noparse][[/noparse] Subroutines ]
    Get_PSX_Buttons:' This routine REQUIRES inverted clock signal from
    OUTPUT PsxCmd
    INPUT PsxDat
    LOW PsxClk
    LOW PsxAtt
    FOR idy = 0 TO 2
    LOOKUP idy,[noparse][[/noparse]$01,$42,$00],tmpout
    GOSUB BitSend
    NEXT
    FOR idy = 0 TO 5
    FOR idx=0 TO 7
    tmpout.LOWBIT(idx)=PsxDat
    PULSOUT PsxClk,2
    NEXT
    buff(idy)=tmpout
    NEXT
    HIGH PsxAtt
    RETURN

    BitSend:
    FOR idx=0 TO 7
    PsxCmd=tmpout.LOWBIT(idx)
    PULSOUT PsxClk,2
    NEXT
    RETURN

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR

    Post Edited (TechnoRobbo) : 8/7/2006 1:50:19 AM GMT
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-07 01:41
    Note I reedited - took out some of my robots code that snuck in.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • aridaiosaridaios Posts: 57
    edited 2006-08-07 04:23
    I tried your last version.No changes.
    My last hope is pin3. I will try it this evening and will inform you.
    My controller works ok when used connected to PS2

    michael
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-07 10:15
    ·would stilllike to see the exact version of the code in your BS2 and Im just curious if your adapting the code or using it verbatim. Try resetting your controller by removing the batteries.· I don't use the native mode cause it does corrupt the· gamepad and I have to reset it by removing th batteries.

    No it's not your last hope, you still have options like reading the data at the trailing edge of the clock.· Since I use a Pelican. I dont see the problems your having - maybe I'll go and get a logitech and find the right timing sequence. Remember that the PS2 Controller is nothing mystical it's well documented.· Here's 2 of the best documents I know of:


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • aridaiosaridaios Posts: 57
    edited 2006-08-07 16:57
    buff VAR Byte(6)

    PsxAtt PIN·8
    PsxClk PIN 9

    PsxCmd PIN 10
    PsxDat PIN 11

    tmpout VAR BYTE
    idx VAR NIB
    idy VAR NIB

    'inits
    PAUSE·5···OUTPUT PsxCmd
    INPUT PsxDat
    LOW PsxClk
    LOW PsxAtt
    FOR idy = 0 TO 8
    LOOKUP idy,[noparse][[/noparse]$01,$43,$00,$01,$00,$00,$00,$00,$00],tmpout
    GOSUB BitSend
    NEXT
    HIGH PsxAtt
    PAUSE 1

    LOW PsxAtt
    FOR idy = 0 TO 8
    LOOKUP idy,[noparse][[/noparse]$01,$44,$00,$01,$03,$00,$00,$00,$00],tmpout
    GOSUB BitSend
    NEXT
    HIGH PsxAtt
    PAUSE 1

    LOW PsxAtt
    FOR idy = 0 TO 8
    LOOKUP idy,[noparse][[/noparse]$01,$4F,$00,$FF,$FF,$03,$00,$00,$00],tmpout
    GOSUB BitSend
    NEXT
    HIGH PsxAtt
    PAUSE 1

    LOW PsxAtt
    FOR idy = 0 TO 8
    LOOKUP idy,[noparse][[/noparse]$01,$43,$00,$00,$5A,$5A,$5A,$5A,$5A],tmpout
    GOSUB BitSend
    NEXT
    HIGH PsxAtt
    PAUSE 1

    LOW PsxAtt
    FOR idy = 0 TO 8
    LOOKUP idy,[noparse][[/noparse]$01,$43,$00,$00,$00,$00,$00,$00,$00],tmpout
    GOSUB BitSend
    NEXT
    HIGH PsxAtt
    PAUSE 1

    'program

    MAIN:
    DO
    GOSUB Get_PSX_Buttons
    DEBUG HOME,BIN8 buff(0)," ",BIN8 buff(1) ,CR
    DEBUG DEC3 buff(2)," ",DEC3 buff(3) ,CR
    DEBUG DEC3 buff(4)," ",DEC3 buff(5) ,CR
    PAUSE 16
    LOOP

    '
    [noparse][[/noparse] Subroutines ]
    Get_PSX_Buttons:

    OUTPUT PsxCmd
    INPUT PsxDat
    LOW PsxClk
    LOW PsxAtt
    FOR idy = 0 TO 2
    LOOKUP idy,[noparse][[/noparse]$01,$42,$00],tmpout
    GOSUB BitSend
    NEXT
    FOR idy = 0 TO 5
    FOR idx=0 TO 7
    tmpout.LOWBIT(idx)=PsxDat
    PULSOUT PsxClk,2
    NEXT
    buff(idy)=tmpout
    NEXT
    HIGH PsxAtt
    RETURN

    BitSend:
    FOR idx=0 TO 7
    PsxCmd=tmpout.LOWBIT(idx)
    PULSOUT PsxClk,2
    NEXT
    RETURN


    I 've also tried resseting the controller but·still no luck.
    It is a great idea to sent you my controller if you'd like!
    I will keep experimenting....

    michael
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-08 09:56
    No need to send it. I will looking purchase a logitech - I'm using my son's controller which he has dropped or stepped on so it looks awful and is held together by electric tape. The logictech can be a nice replacement and the Pelican can stay with the robot.

    It will take a day or so till I get around to it. I'm busy working on the robot's cannon (a bit more powerful than I anticipated).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • aridaiosaridaios Posts: 57
    edited 2006-08-08 19:27
    ok TR,

    I will be waiting for your reply

    michael
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-09 11:06
    I purchased a MadCatz MicroCon Wireless at Gamestop $20. It appears to go through it's own initialization sequence. I have to anaylize it -but my exeprience was the same as yours. The Pelican works 100% of the time the Mad Catz 0%. I'll keep trying but I think that maybe the Pelican (also $20) may be the way to go wireless. The Pelican has channel buttons while the Mad Catz coordinates for channels - I think this has something to do with it. Will test more.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • aridaiosaridaios Posts: 57
    edited 2006-08-10 04:57
    Does anyone know where to buy a Pelican controller in Europe?

    michael
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-15 03:26
    http://www.pelicanacc.com/

    Gamestop or EB Games perhaps they're in europe

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • aridaiosaridaios Posts: 57
    edited 2006-08-16 13:39
    I couldn't find a Pelican controller anywhere in Europe.
    I just bought a Thrustmaster wireless controller and it works just fine!!
    Only the button with the square on it is allways pushed.

    michael
    ·
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-18 11:04
    Thats good news. I modified my circuit board and am no longer using the transisor- I figured that I'll never use a wired controller anyways. That means I invert the software Clock pin logic to look like this:

    '
    [noparse][[/noparse] Subroutines ]
    Get_PSX_Buttons:' This routine REQUIRES inverted clock signal from
    OUTPUT PsxCmd
    INPUT PsxDat
    HIGH PsxClk
    LOW PsxAtt
    FOR idy = 0 TO 8
    LOOKUP idy,[noparse][[/noparse]$01,$42,$00,$00,$00,$00,$00,$00,$00],tmpout
    GOSUB BitSend
    buff(idy)=tmpout
    NEXT
    HIGH PsxAtt
    RETURN

    BitSend:
    FOR idx=0 TO 7
    PsxCmd=tmpout.LOWBIT(idx)
    tmpout.LOWBIT(idx)=PsxDat
    PULSOUT PsxClk,1
    NEXT
    RETURN

    The Square may be a pin coordination issue. Make sure you set your clock pin before you set you the Select (attn) pin. I'm sure with a few tests you'll get the Square key working.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • aridaiosaridaios Posts: 57
    edited 2006-09-09 18:57
    Does it mean that a wired controller will not work with this code?

    I am trying to attach an external antenna to a thrustmaster controller in order to expand its range.
    Does anyone have tried it out?

    michael
  • raresttyleraresttyle Posts: 11
    edited 2006-09-16 03:12
    Hey, unfortunately I dont use Basic Stamps, but instead use the Pic chips, I have been trying to get an interface working for sometime now and I was wondering if you all could help as much as u can. I have essentially taken the code originally provided and modified it to be understood in PicBasic. The results so far is that when turned on the reciever's led flashes once, then I have to hit the connect button on it. From here on the Led blinks regardless of what I do with the controller. Here is the code I used, plz help me as much as u can,thnx.

    MAIN:
    output 2 'set cmd line as output
    input 3 'set datline as input
    High 0 'set Clk high
    LOW 1 'Set Att low
    FOR B1 = 0 TO 2
    LOOKUP B1,($01,$42,$00),B0
    FOR B2=0 TO 7
    Pin2=bit0 'Place 1st bit on cmd pin
    PULSOUT 0,2 'send clk pulse
    B0=B0/2 'shift Bits to the right
    NEXT B2
    NEXT B1
    FOR B3 = 0 TO 5
    FOR B4=0 TO 7
    Bit0=Pin3 'get bit from controller on dat pin
    PULSOUT 0,2 'send clk pulse
    B0=B0*2 'Shift Bits to the left
    NEXT B4
    NEXT B3
    HIGH 1 'Bring Att high
    Goto Main 'Do it again
  • raresttyleraresttyle Posts: 11
    edited 2006-09-16 03:13
    Oh yea, I almost forgot, The controller Im using is a chameleon pelican as well, cept it doesnt have a channel button

    Post Edited (raresttyle) : 9/16/2006 10:44:07 PM GMT
  • raresttyleraresttyle Posts: 11
    edited 2006-09-16 11:58
    hello again, I did some quick tests last nigt and this morning. I slowed down the code a lot so I could better see what was happening to try to find the problem and here are some results that may help: If I only have the clk line hooked up, the reciever will allow me to hit connect and start blinking at once, THEN if I have the att and clk line hooked up it wait for the first 8bits before allowing me to hit connect and start the connection. FINALLY if I have all 3 (clk,att,cmd) hooked up, it waits for the first 15bits out of the 16 in the two commands before allowing me to start it.

    it also blinks once at the very start of the program

    I hope this helps clarify whatever problem I have.

    Post Edited (raresttyle) : 9/16/2006 8:24:50 PM GMT
  • triplebirchtriplebirch Posts: 6
    edited 2006-09-16 15:06
    wow this is a cool idae but i am new to rootics and i don't get how to hook up the controler
  • raresttyleraresttyle Posts: 11
    edited 2006-09-16 16:57
    hey triplebirch, The wiring diagram is earlier in this thread, so what exactly do u need to know about hooking it up?
Sign In or Register to comment.