SNES Controller Decoding

Includes but not limited to: SNES, Genesis, Sega CD, PlayStation 1, Nintendo 64, Dreamcast, Game Gear and I guess the Virtual Boy.

Moderator: Moderators

Electric Rain
Senior Member
Posts: 1911
Joined: Tue Mar 29, 2005 12:39 pm
PSN Username: Denki_no_Ame
Location: What's it to you? Stalker...

Post by Electric Rain »

No. I've done that as well, it's quite easy. My SNES controller is hooked up to it right now.

You've got the general idea. But I don't want to use a computer for decoding. I want to be able to decode it with circuitry, so I can use the outputs for something else.

BTW, is there anyone here that is experienced enough with microcontroller coding to edit the code on that site and adapt it for use with an SNES controller? (So I have more buttons.) You'd also need a PIC with more I/Os, though.
Image
Super Mulletman
Posts: 390
Joined: Sun Apr 18, 2004 12:17 pm
Location: Wherever my orders let me be
Contact:

Post by Super Mulletman »

I seem to remember a website that had guides for things like N64, or PS1 controllers using microcontrollers, but I don't know if they had SNES controllers, or even what the URL was. Of course, there's always this little number, but they won't be in stock 'til June.
Gummo
Posts: 33
Joined: Fri Dec 24, 2004 11:45 am
Contact:

Post by Gummo »

I've been trying to do the exact same thing you want to do electric rain. I've actually been semi-successful in making a snes decoder. The only problem is that my decoder only works while using the SNES system. Since the SNES controller uses parallel->serial shift registers, I made a circuit with serial->parallel shift registers that will decode all the button presses. The problem that I have is that I still need to clock it and all that good stuff, so if I use the latch and clock lines from the snes motherboard, I can actually get all of the decoded button presses. I've even tested it out using leds to make sure it worked (and it did).

I really don't know all that much about electronics, so I don't know how to solve the latch+clock problem. I can draw up a schematic of the circuit I made if anyone thinks they can help me out.
nos_slived
Higher Idiot
Posts: 3476
Joined: Mon Mar 21, 2005 6:32 pm
Location: Burnaby, BC, Canada
Contact:

Post by nos_slived »

It would be interresting to see your schematics.
Image
Gummo
Posts: 33
Joined: Fri Dec 24, 2004 11:45 am
Contact:

Post by Gummo »

I drew this schematic as fast as I could with paint shop pro, so its not going to look too pretty, but it will suffice.
Image

DL this PDF file of the data sheet for the Serial-In Parallel -Out Shift Register I am using
http://gbarcade.lookitsmysite.com/schem ... hc959n.pdf

When using the snes system, you can hook up the clock,vcc,ground, and serial input (data line) to the corresponding pinouts on the snes controller port. Because all of the pinouts for the buttons on the shift register will be high when a button is not pressed and low when pressed, I inverted the signals in the circuit so that when leds are hooked to the button output pins, they light up when a button is pressed (I used NPN transistors as my inverters). When using the snes system for its clock and latch lines, you'll also have to have a game running too.
Last edited by Gummo on Mon May 30, 2005 12:13 pm, edited 1 time in total.
nos_slived
Higher Idiot
Posts: 3476
Joined: Mon Mar 21, 2005 6:32 pm
Location: Burnaby, BC, Canada
Contact:

Post by nos_slived »

You should be able to reverse the LEDs and use them without the NPNs, because when the pin goes low it will probably connect to ground.
Image
Gummo
Posts: 33
Joined: Fri Dec 24, 2004 11:45 am
Contact:

Post by Gummo »

That shouldn't possible. I thought about what you said, but if that pin is connected to ground, when it goes high, wounldn't it short the circuit? Plus you would be acting like that pin was an input instead of an output.

BUT! I'm going to test that out and see what happens, because I'm highly curious on who'd be right.

btw, it really doesn't matter because I'm using the leds just for testing, so they aren't too important to the circuit. Whats more important is not having to use the snes's clock and latch line. Yet, I wouldn't mind being able to remove 12 transistors from the circuit if I don't need them.
gannon
Moderator
Posts: 6974
Joined: Sun Apr 04, 2004 4:48 pm
Location: Near that one big lake
Contact:

Post by gannon »

Here's the SNES clock circuit
Image
Gummo
Posts: 33
Joined: Fri Dec 24, 2004 11:45 am
Contact:

Post by Gummo »

Wouldn't that clock signal be different from the one thats being sent over the controller port?
gannon
Moderator
Posts: 6974
Joined: Sun Apr 04, 2004 4:48 pm
Location: Near that one big lake
Contact:

Post by gannon »

I don't know. I'd assume that the snes and it's controllers run on the same clock though. I could check though.
Edit: yeah, you're right. The controllers clock lines come from the CPU. I'm guessing that only 1 controller is read at a time, so maybe building a standard clock with a latch circuit would work.
Gummo
Posts: 33
Joined: Fri Dec 24, 2004 11:45 am
Contact:

Post by Gummo »

Would work! yay!

Now we just need someone to build that clock and latch circuit...
Also, would the clock and latch circuit have to mimic closely the protocal that the cpu uses to get the data from the controller? For example, will it have to hold the latch high for 12 us then wait how ever long, then start clocking... I cant remember the whole snes protocal that actually gets done, but you get the point.
nos_slived
Higher Idiot
Posts: 3476
Joined: Mon Mar 21, 2005 6:32 pm
Location: Burnaby, BC, Canada
Contact:

Post by nos_slived »

Gummo wrote:That shouldn't possible. I thought about what you said, but if that pin is connected to ground, when it goes high, wounldn't it short the circuit? Plus you would be acting like that pin was an input instead of an output.

BUT! I'm going to test that out and see what happens, because I'm highly curious on who'd be right.
All I know is that the pins of several chips are always connected to either voltage or ground, and depending on the LEDs you use, they should go off when the pin goes high. It wouldn't short, because you aren't connecting V+ directly to ground, you are just pushing current against current, so it stops flowing.

BTW: I just thought, are you sure you aren't using PNPs? NPNs(or atleast 3904s) are normally open, and create a closed(complete) circuit when they go high. PNPs(3906s) are normally closed, so when the pin is high, it would create a broken circuit, which would be completed when the base goes low.
Image
Gummo
Posts: 33
Joined: Fri Dec 24, 2004 11:45 am
Contact:

Post by Gummo »

I'm sure I'm using NPN transistors.
I'm using them as not gates.
http://www.kpsec.freeuk.com/trancirc.htm#inverter[/url]
nos_slived
Higher Idiot
Posts: 3476
Joined: Mon Mar 21, 2005 6:32 pm
Location: Burnaby, BC, Canada
Contact:

Post by nos_slived »

Ok. I thought you might have gone right through the transisor. I never even thought about using it like that when you said you were using transistors. I was just think of PNPs for simplicity.

BTW: Have you tried reversing an LED direct to the pin?
Image
Gummo
Posts: 33
Joined: Fri Dec 24, 2004 11:45 am
Contact:

Post by Gummo »

I just tried it out, and yes it works. Hooked up the pin to the negative side of the led and the Vcc to the positive side. I hope thats what you ment by reversing the led, because when I tried literaly reversing the led (pin to the neg side and ground to the pos side) nothing happened. Then I thought about it and figured out why that wouldn't work, cus leds are indeed diodes and diodes dont like to allow reversed flow. Edit: I just thought about it and realized that the whole thing is pointless because there wont be any leds for the button presses in the final snes controller decoder circuit (well, unless you really want them, they were just there for testing the circuit). The whole point of the transistors was to invert the signal from the pin so that the decoder could be useful, like using an snes controller for another system (unless you need the signal to be high when the button isn't pressed, then you wouldn't need the transistors).
Post Reply