Moving the PS2 controller to other IO pins on the BAP

Looking at the H8/3694 spec and looking at the ATMega640 spec it looked like their pull-up max amps were similar so I thought I would try it out. So I modified my Mechbrat and moved the PS2 from pins 12-15 to P0-P3 like:

PS2_ON_PIN0 con 1 #ifdef PS2_ON_PIN0 PS2DAT con P0 ;PS2 Controller DAT (Brown) PS2CMD con P1 ;PS2 controller CMD (Orange) PS2SEL con P2 ;PS2 Controller SEL (Blue) PS2CLK con P3 ;PS2 Controller CLK (White) #else PS2DAT con P12 ;PS2 Controller DAT (Brown) PS2CMD con P13 ;PS2 controller CMD (Orange) PS2SEL con P14 ;PS2 Controller SEL (Blue) PS2CLK con P15 ;PS2 Controller CLK (White) #endif
Then in the init code for the PS2 changed to:

[code];PS2 controller
#ifdef PS2_ON_PIN0
PUCR5.bit0 = 1
#endif
high PS2CLK
LastButton(0) = 255
LastButton(1) = 255

[/code]
And built my MechBrat. Argh after I uninstalled the version 16 of studio and installed version 14 so my SLONGS would compile. Then after moving the Laser define off of pin0 and rebuilding, it WORKED! :smiley:

Again if anyone wants to try this with different IO pins they need to make sure there is a pull-up for the DAT pin. This information is in the post: viewtopic.php?f=4&t=4534

Note: I split this off of the troubleshooting PS2 post…

Kurt

Hi Kurt!

That’s some pretty cool info you posted there. I made it a sticky for ya. Thanks!

HI,

I would like to connect two atoms pro (40 or 28) running “PS2ROV4.BAS” program via USART.As the Usart Pins in the mentioned atoms are 14 and 15 and in the program Pins 12-15 are used by PS2 contoller, I ask if I can move to other pins like asserted in this topic so I can use pins 14-15 for the Usart.If that is feasable I’ll need a help to modify/integrate the code.Help will be very apreciate.Thanks in advance,

Carobot

It has worked for me on an CHR-3 hex robot. I put the PS2 on pins 0-3 as I left the xbee on Hserial pins 14-15 on Bap28.

Kurt

Hi all,

I’ve been trying to get the ps2 controller to work on both a Tri-track and BRAT robot for pins 0-3. (BAP28 on a Bot-Board2)

I can confirm that they work on 12 to 15 but so far I’ve had no luck with other pins, I can’t seem to get a proper connection at all. Is there something that has changed between March 2010 and now that hasn’t been mentioned? I’ve tried two different controllers (wireless from lynxmotion and official wired).

Appreciate any help in advance,
Ben

Break out the schematic for the Botboard II. Look for a pullup resistor of 1k on the data and clock lines. These need to be installed on the other pins if you want to move the controller.

Thanks for the help so far,

I’ve added a 1k pull up resistor to the P0 and P3 lines. The red light turns on on the receiver (no green light) but both red and green lights on the controller flash simultaneously, and the default program for the Tri-Track +PS2 keeps reseting as the controller remains unregistered.

Thanks again,
Ben

Did you change the program on the tri-track to use pins p0-P3 instead of P12-P15?

In particular in the file ps2a4wd1.bas, did you change these lines:

DAT con P12 CMD con P13 SEL con P14 CLK con P15

To:

DAT con P0 CMD con P1 SEL con P2 CLK con P3

Kurt

I did, yes. I’ve also added “PUCR5.bit0 = 1” to the equivalent part.