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?