Ancient

February 27, 2010 · Posted in Electronics · Comment 

Who still remembers the good ol’ days of the PlayStation One?

I certainly do. It has been the only game console (the venerable gameboy aside) that I’ve ever owned, and back in the day, I used to play on it a lot. I never got any other consoles afterward though, but that’s mostly because I’m not too much of a gamer anyway (an occasional game I enjoy, but not much more than that) and I don’t want to spend a fortune on a console, another fortune on accessories, another fortune on games, and even more fortunes if you want to be able to play said games online. Especially not if all of those fortunes are not going to be used more than once or twice a week, at best.

Anyway, on a little side project, this week I took an old PSX controller for something different. What else than play PlayStation games can one do with a PSX controller, you might ask? Well, hook it up to a microcontroller and use it to control whatever you want, of course!

The something else to control is kind of missing in this picture, but you get the idea. There’s a PlayStation controller hooked up to a PIC18F2520 (its a PIC18F2520 because I happened to have it at hand, and it’s running at 40 MHz – not because that much is needed to read a few buttons, but because all my delay routines and template configuration files are based on that and I was too lazy to adjust everything). There’s a few LEDs for testing purposes, RS232 connection which sens the state of the controller out to my PC, and my trusty USB logic analyzer (which is awesomely useful in projects like this).

Interfacing the PSX controller isn’t all that difficult. There are nine wires – two for power to the controller (red and black for +5V and GND, respectively), two for power to the vibration motors (various sources state 7-9 V, but they run on 5 V just as well), and five wires for communication (one for bits sent to the host, one for bits sent to the controller, clock, attention (like the chip select in SPI), and an acknowledge signal from the controller). The clock runs at 250 KHz (500 KHz for the newer PS2 controllers, though the protocol for those is identical). During a transmission the attention line is made low by the host, data is clocked in at the rising edge of the clock signal, and after each byte the controller pulls the acknowledge line low for a short period – in other words, fairly simple stuff. The only thing that is kind of annoying is that it is a synchronous protocol (i.e. data is sent to and received from the controller at the same time), but otherwise, it’s not hard.

The PIC asks the controller ‘how are you?’ about 50 times a second, and the controller responds with 6 bytes of useful data – 2 bytes for all of the buttons (there are exactly 16 buttons, so that’s convenient) and 2 for each of the analog sticks. The PIC compares the data to an internal buffer to detect if something has changed, and if so, the output on the serial console is updated. It poops out the status of all buttons, with some VT100 terminal control codes to clear the screen and make the output look pretty. On powerup, there is even a pretty screen with the classic “Press Start” message (in blinking text, woohoo!).

Unfortunately that is about as far as it goes right now. If I had more of these controllers and a little graphical LCD, you could do fun things with it though! (I need to keep that in mind :P )

Furthermore, I am also starting to play a bit with ARM microcontrollers. Got an evaluation copy of CrossWorks for ARM (which is an awesome piece of software – expensive, but awesome!), and a bunch of LPC2103/2138 chips (LQFP packages… not a lot of fun, but quite doable with a bit of practice). These chips are an awesome platform for a lot of things, thanks to their speed and memory size, which would put any PIC or AVR to shame, and with a much more efficient instruction set as well. But more on that later.

Mass Effect 2

February 8, 2010 · Posted in Blog · Comment 

I’ve enjoyed playing the first Mass Effect game a while back, and just finished Mass Effect 2.

The short version?

I like it! Possibly better than the first, although I was kinda disappointed that only such a small section of the citadel is accessible.

Which leads me to the one thing that did bother me throughout the game… Like so many other games, it suffers from what I call the Pokémon effect. Every object, every character, every place you encounter is there for a reason. Aside from general things like NPCs that run a store, EVERY character you can actually talk to or who makes remarks you pass by, is there for one assignment or another. Every door, corridor and room exists for a specific reason, and more annoyingly, nearly every object placed in those rooms as well. Specifically I’m referring to objects that can be used as cover during a firefight (or objects that can be used to your (dis)advantage, such as the explosive containers), because those kinds of objects are only found in the locations where you will be fighting, and just by looking what objects there are ahead of you makes it really easy to predict if/when you’ll be attacked. Also the game world is very linear; yes, you can fly your ship around in between missions, but once you’re on a mission there is only the correct way a head and every other path is conveniently blocked by stacks of crates, a door that cannot be opened, or debris (except for the occasional sideroom that’s got a few goodies you can pick up).

A good example of a game that doesn’t have this problem would be Oblivion. For instance, there are lots of houses you can visit, with one or more people living in them, that aren’t of any real significance. Occasionally you need them for a quest, but otherwise they’re just decoration (yes, you can rob them or use them as food if you become a vampire, but otherwise). Even during a quest you’re mostly free to move as you like rather than being forced along one specified route.

The tons of voiced dialogue and voice acting were outstanding, and is something I can really appreciate in a game. They could have come up with a few more lines for teammates to shout during combat though; when you hear the same lines five times over during each firefight, they tend to get boring (even annoying) quickly.

Nevertheless – Pokémon effect aside, I can definately recommend ME2. Oh, and this time around I am going to make sure I keep the save game to import it into the 3rd installment of the Mass Effect games :)