Mikromedia for PIC18FJ: "Pong" game


Games. Who doesn’t like to play them… But did you ever try to venture behind the game screen? You’ll find out things are quite different. In fact, writing a game is more complicated and difficult than you have ever thought.

This blog post is more than two years old.

To make a successful game you need some good ingredients: nice graphics, a good game engine, and entertaining sound. Each of those is complicated in its own, least to say putting all together. And how about a game that runs on a PIC microcontroller, even if that particular microcontroller is picked from the high-range of Microchip 8-bit PIC microcontrollers: the PIC18F87J50 has 128kb of FLASH, 3904 bytes of RAM, and it’s capable of reaching 12MIPS at a click frequency of 48MHz. Is this enough to play a game? We shall see…

As in many of my projects I will start with a short presentation of the hardware: I used an Mikromedia for PIC18FJ board, the simplest of the Mikromedia range from the Serbian manufacturer MikroElektronika.

On the back side of this board we notice the PIC18F87J50 microcontroller, the VS1053 Stereo mp3 coder/decoder, microSD Card Slot, ADXL345 accelerometer, and one M25P80 – 8Mb, Low-Voltage Serial Flash.

The board can be powered via Li-Polymer, an on-board battery connector being provided. The battery can be charged via the same micro-USB connector used for programming, with a charge regulator implemented with an MCP73832. The Mikromedia boards are 3.3V only, and a regardless if USB or battery power used an LD29080DT33 regulator is used to provide this voltage.

On the font side we will find a 320 x 240 touch-screen TFT display, and the reset button. Quite an impressive hardware for a board this size.

To make for an even better game experience I placed the Mikromedia for PIC18FJ on an Mikromedia GAMING Shield, which provides an extra set of buttons, and it fits nicely in my hands.

Mikromedia GAMING Shield

Mikromedia GAMING Shield

To gain some autonomy I also used one Battery Boost Shield, which allows for the whole thing to be powered from a set of 1.5V, AAA batteries.

1 2 3 4 5

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.