Close

Display and Microcontroller

A project log for TIS-104-real

A hardware implementation of the TIS-100 computer game.

rasmus-svenssonRasmus Svensson 11/29/2016 at 19:170 Comments

During the last months we have experimented with some hardware. We found a cheap 2.2 inch display on Ebay with a 176x220 pixel resolution called ILI9225. It was the cheapest display we could find (about $4) that had enough pixels to display the TIS-100 GUI.

We also bought some AVR ATMEGA328P-PU microcontrollers, the same one as the Arduino UNO R32 uses, but we ended up using an Arduino board for the tests so far.

The next step was to try out the display. We assumed that since the display seemed popular, there would be many graphics libraries that supported it. It turned out to not be widely supported. We found the u8glib library that had a nice API and supported many displays (but not ours). We tried to add a driver for our display to it and actually got it working. However, the limited clock speed of the AVR MCU combined with the design of the library made it very slow for us. The framerate was less than 1 Hz.

The u8glib library supports drawing many kinds of graphics (text, polygons, etc) using a limited amount of memory. It does so by running the graphics code multiple times. Each time it masks away everything except a few lines, an thus only needs to use memory for those lines. Our driver was also using an inefficient method to send pixel data, but we did not know that yet. For our uses it made the wrong trade-off between CPU and memory.

We then decided to write our own code for just what we needed: a matrix of characters, and a character to pixels mapping (that is, a font), dirty rectangle handling, and a way to turn rectangles of pixels into SPI commands. After some optimization of how we sent the pixel data and extensive debugging, it worked! We got an update rate of about 30 Hz.

Discussions