Sunday, October 3, 2010

One step forward.... two steps back....

Over the course of the weekend, I have come to the realization that the ATMega 328 isn't going to have enough IO pins to be able to control all the electrical signals needed to manipulate a PS3 controller. Because of this, I have put the PS3 controller hacking on the back burner for a little while. I'm going to have to get one of the newer Arduino XMega boards in order to get this project fully working.

In the mean time, I set about taking on a similar, yet smaller, project. I decided that it would be a good exercise to take the idea and adapt it to an NES controller. I started by finding the pinout for the shift registers used in old NES controllers and soldering wires to the board for each of the eight buttons on the controller. Then it was time to write the firmware for the ATMega328. When it boots, the ATMega waits for the computer to send a connect signal. In this case the connect signal is a C character. Upon receiving the connect signal, the Arduino responds with an R for ready, and then program control is transferred back to the main loop where any serial data that's read will be translated into button presses. I know that the whole connect step is kind of overkill when all the controller data can be sent in one byte, but this will be a lot more important when I start on the PS3 version.

The only thing keeping me from being able to finish this and post everything up is that I'm currently downloading the DirectX SDK, which is over half a gig in size. I decided to use direct input instead of SDL because there's a lot more versatility built into direct input than what I remember from messing around with SDL.

All this work isn't just for the hell of it, though. This test will give a good indication of how many updates per second we'll be able to get for the PS3 version once I get an Arduino that has enough IO pins. Also, doing all this work will help speed things along once I get started on the PC-side software for the PS3 version. In fact, most of the code that I've written thus far will port over without having to do much of anything.

The DirectX SDK will be done downloading sometime later tonight, and I should be able to get everything finished, documented, and posted up sometime tomorrow night.

1 comment:

  1. Good to learn on a NES controller. I'd never use one after almost blowing my thumbs out back in the day playing MegaMan and other assorted games lol.

    -dx

    ReplyDelete