Posts Exploring Nokia 3310 LCD
Post
Cancel

Exploring Nokia 3310 LCD

Hi,

This project is a general purpose library implementation for the famous Nokia 3310 LCD (PCD8544). Almost everybody has old phones like 3310 at home. If not, you can buy it for a few dollars, which is pretty cheap I think for at least for a graphic LCD. The display can be controlled easily on several AVR pins.

In this post I will show you a demo application for my 3310 LCD general purpose AVR library.

A couple of weeks ago I tried to use my old 3310 LCD. The display was already disassembled from the phone, but I somehow always failed to drive it with any AVR. Now the solution is ready! Many people made many library implementations, so I made mine of course :-).

Hardware

The first achievement was to use the LCD in 5V environment (LCD needs 3,3V supply). The schematic looks like:

Pinout for the LCD:

Of course we need a 3,3V regulator, but the bus lines are simply connects to an 5V powered AVR (trough resistors).

Also many solutions out there for the cabling and holding the display in it’s place. It has to be ‘surface mounted’ as it has no real pins to solder. My solution look’s like this:

I’ve taken the metal cover as well, and with the original screws I fixed it onto a piece of PCB (now it is breadboard friendly).

Software

The second thing was the driver. As I said previously, there are a lot of them. I picked up the first which was working and started to make some simple application on top of it. The result was the complete rewrite of the original code (LCD initialization and the font was held). Now the solution is using buffer instead of always drawing the content directly to the LCD. By this the application can trigger the update of the LCD after all the changes were made. The driver will always update only the modified pieces of the LCD since the last update procedure.

Several solutions has limited text drawing capabilities. This means that the LCD is 48x84 pixel, divided into 8 pixel wide vertical pieces. These pieces can be addressed for update. As the fonts are using 7(+1)x5 pixels, the easyest solution is to put them into these 6 lines (48 divided by the 8 pixel wide vertical piceses –> 6 line of text), means you can draw letters to six fixed lines, and nothing more. My solution can put text at any exact location.

I had ATmega168 for the application, but as it uses no extra interrupts, you can use it with any other AVR (you only have to port the usart defines, as they are different for example for mega8).

Current library functions:

  • initialize and reset the LCD
  • set contrast
  • set or clear one pixel in the buffer by x-y coordinate
  • set byte in buffer: puts one raw byte into an 8 pixel vertical pixel place
  • updated the LCD from the buffer
  • clears or fills a given area of pixels
  • going to any coordinate for drawing text
  • draw a single character or a complete string into the current location
  • clear all the content from the buffer of directly on the LCD

Now you can draw rectangles, lines or text onto the LCD. One more thing is missing I think: to have an interface for the PC to easily transfer fullscreen data, for trying out some background picture for your future applications. I made a solution in C# to make the drawing and the transfer easy.

I added a MAX232 for RS232 communication, but you can convert it to USB if you want. The LED indicates if data is currently coming from the PC. The program will accept LCD data from the PC if the PD7 is connected to the GND. If not, the internal example will taken into account (some text will moving on top of the PGB splash screen).

So you can:

  • load BMP or GIF files (lots of them are on the net, or you can draw it is paint if you want)
  • drag the visible part of the picture with the mouse (if picture is bigger than the LCD resolution) or set it by the X-Y offset buttons
  • in live mode, the picture is visible on the display immediately, so you can see how your stuff looks like
  • generate C array declaration for the current picture, which you can store to PGM and display it by the AVR sw after reprogramming (example code included)

The downloadable application contains:

  • the LCD library
  • usart library for PC communication
  • several usage example for the library and also for drawing the PGM data, which was exported from the GUI

Used stuffs:

Downloads:

Feel free to contribute as usual! It might be cool to add some backlight control feature for example ;-)

Cheers

This post is licensed under CC BY 4.0 by the author.