Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Video Game Controllers: A bit rate question

Status
Not open for further replies.

DigiTan

New Member
I'm programming an AVR micro to use as an interpreter for **broken link removed**. I plan to use these controllers as a "standard keypad" for some of my future projects. I did some searces and found a few places that explain things like the pinouts, serialized polling, and all that jazz. But they never mention what bit rate I need to shoot for. Can anyone tell what bitrate they use?

So far I can only guess.

BTW- Does anyone know what the Playstation "NegCon" controller is? I can't find any pictures and I'm still trying to figure out what the heck this thing does. Apparently, some of its buttons are pressure-sensitive.
 
Are you planning to use a PS one controller or a PS 2 controller. There is a difference. I have been working on a similar project. The ps controller that I am using is an official Playstation controller. Not sure what the max data rate is but I am checking the joystick at roughly times per second. The chip is running of a 4Mhz clock so data transfer clock is roughly 50kHz or about 50kbps.

Never heard of a NegCon either. PS 2 controllers use pressure sensative buttons. PS 1 use straight digital buttons.

Hope that helps.
 
Yep. That helps alot. I was mostly worried about going over the max rate. Right now I'm planning to use all four PS 1 controllers types (digital, negcon, analog red and green). I tried some more sleuthing and finally found **broken link removed** of a NegCon. Still trying to figure out exactly what it does.
 
That thing in the pic is a horrible controller, it has a joint in the middle so that you can 'TWIST' the controller - imagine they horrible cheap radio control cars, the conroller with the wheel on the side, its kind of like that action, on you can twist it both ways.
 
DigiTan said:
I'm programming an AVR micro to use as an interpreter for **broken link removed**. I plan to use these controllers as a "standard keypad" for some of my future projects. I did some searces and found a few places that explain things like the pinouts, serialized polling, and all that jazz. But they never mention what bit rate I need to shoot for. Can anyone tell what bitrate they use?

So far I can only guess.

Since it is the AVR that has to generate the clock, maybe you should try a something like 100 - 500 uS clock periods. That seems to work on most Master/slave type serial communication devices.

Jem


BTW- Does anyone know what the Playstation "NegCon" controller is? I can't find any pictures and I'm still trying to figure out what the heck this thing does. Apparently, some of its buttons are pressure-sensitive.
 
Thanks for the help Jem (it took me a while to locate your message in the quote box though). The NegCon controller sounds like an odd piece of eqipment. I guess the twisting action is the "steering" byte they refer to in the taables. Any idea of what "I Button", "II Button", and "L1 Button" are used for or why they have psuedo-analog outputs as well?

Code:
    NegCon

    BYTE    CMND    DATA

     01     0x01    idle
     02     0x42    0x23
     03     idle    0x5A    Bit0 Bit1 Bit2 Bit3 Bit4 Bit5 Bit6 Bit7
     04     idle    data                   STRT UP   RGHT DOWN LEFT
     05     idle    data                   R1   A    B
     06     idle    data    Steering  0x00 = Right 0xFF = Left
     07     idle    data    I  Button 0x00 = Out   0xFF = In
     08     idle    data    II Button 0x00 = Out   0xFF = In
     09     idle    data    L1 Button 0x00 = Out   0xFF = In
 
Here's an interesting story I stumbled across...

Sony Playstations Used In Military Combat

BAGHDAD, Iraq – Sony on Friday announced that it would investigate claims by a former US military official that parts from its Playstation 2 video game console are being tested in military equipment for operations in Iraq and Afghanistan.

According to the official, who wished to remain anonymous, the US military has been purchasing hundreds of Playstation analog controllers and retrofitting them to Abrams tanks, Bradley fighting vehicles, and missile defense computers at the US command’s headquarters in Baghdad.

Sony’s main distributor in Europe, Centresoft, has been providing the military with the controllers, says Stewart Richmond, chief legal counsel for Sony Europe.

Throughout the late-nineties it was widely speculated that the US military used video games to train soldiers for combat. But advances in technology and gaming ability among younger soldiers led engineers to base the next generation of command/control hardware on the Playstation controller, according to the former military official.

This is troubling to Sony executives because there is wide speculation that the Playstation controllers were tested in a military exercise in Southern Iraq where 72 Iraqi soldiers and 300 civilians were killed. Fifteen US soldiers were killed from friendly fire.

“While it’s nice that they’d [US Army] use our controllers to help fight the war on terror,” says Sony spokesman Yoshikazu Ochiai, “We’re a little concerned about our products being used to harm people.”

Lawyers for Sony also say the US military may be violating international law for not letting the company know its products are being used for military purposes.

During the Vietnam War, Mattel successfully sued the US Air Force for airdropping “Vietcong” Ken Dolls over North Vietnam in hopes of taunting the communists.

“The soldiers today are so used to handling the Playstation controller,” says one former military official, “it makes perfect sense that they’d use it to control army tanks and shoot missiles.”

According to military engineers, the Playstation controllers offer more pinpoint accuracy than their current set of controllers, which were mainly developed during the 1970s.

Top military officials in Baghdad and the US Central Command at MacDill Air Force Base in Florida refused to comment for this story.

I also have one more question. Are any of the PS2 controllers compatible with the PS1 systems (same serialized polling method)? Can't find any data on them.
 
Okay, I've been working on this all week and I finally got things to work. More or less....

I'm experiencing a very bizzare problem with the incoming key data. As far as I'm able to detect, my outgoing commands are intact and noise-free, however the key information doesn't make sence. According to the internet sources, each key is supposed to affect the incoming bits in this fashion...

Code:
Analogue Controller in Red Mode

BYTE    CMND    DATA

01     0x01    idle
02     0x42    0x73
03     idle    0x5A    Bit0 Bit1 Bit2 Bit3 Bit4 Bit5 Bit6 Bit7
04     idle    data    SLCT JOYR JOYL STRT UP   RGHT DOWN LEFT
05     idle    data    L2   R2   L1   R1   /\   O    X    |_|
06     idle    data    Right Joy 0x00 = Left  0xFF = Right
07     idle    data    Right Joy 0x00 = Up    0xFF = Down
08     idle    data    Left Joy  0x00 = Left  0xFF = Right
09     idle    data    Left Joy  0x00 = Up    0xFF = Down

...This works for the joysticks (lines 6,7,8, and 9), however the keys (lines 4 and 5) will influence the bits incorrectly. For example, when I press "Right," the bits for "Right", "Down", and "Left" will be affected. And when I press "Up" the bits for "Up", "Right", and "Down" are affected. Basically, when one of my bits goes low, it seems to "pull" two higher bits into the same state. What's worse is that if the "Left" button is pressed, the problem will 'spill over' and affect the bits for "L2" and "R2" in Line 5.

At first I assumed this was happening because my bit rate was too high to allow the input lines to settle. But this doesn't account for the Joysticks working.

Right now, I'm sampling the controller 60 times each second at a bit rate of ~9600bps. The microcontroller is an AVR 2313 running off a 5volt regulator. The keypad runs off the same regulator. There are 0.22uf capacitors on both sides of the regulator, plus a few more noise counter-measures.

I should also probably mention that the PSX controller was used, and I've recently discovered that it had been unscrewed by the previous owner.

Any theories?
 
Okay, I finally did some more sleuthing and it turns out it was the bitrate all along! It appears that the 9600bps sample rate was causing single incoming cleared bits to be seen as 3 consecutive bits. Appearantly, this was no problem for the keypad's controller, as it was able to understand my outgoing commands.

Anyway, I cut the bit period down to roughly 216us to run at 2400bps and now it works perfectly. Hopefully, I'll be able to operate a higher rates again with more testing. Here's the AVR-based test circuit to monitor the 1st row of keys:
**broken link removed**
...if anyone wants a copy of the source code, just PM me and I'll send you the PSX interrupt. :wink:
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top