Anleitungen, Arduino

[Arduino] Connecting a Nokia 5110 display to Arduino – Part3: 5×7 bit ASCII representation

In this part of the Nokia 5110 display tutorial I am going to explain the representation of an single ASCII character on the display. Let’s have a look on the code again. In the top part of the code a very long array is defined:

static const byte ASCII[][5] =

Let’s examine the code for the explanation mark(!) in line two.


Every character in this code example is displayed in an 5×7 matrix. This means that every hex-value (byte) of data represents one row in this matrix. As you can see the first and last two bytes of the explanation mark data is empty/null so that only the row in the middle is filled. As you remember we set the display controller to draw the data horizontally that means that every byte of data is saved row after row. If the controller reaches the 84th byte of data it jumps to the next column. Have a closer look at point 7.7 of the PDC8544 datasheet to undertand this fact.

Have a look at this picture to understand the 5×7 pattern.

Describing image of the representation of an ASCII character with a grid of 5x7 bits

As you can see the eighth bit of data is not part of the actual character. It is used to create a margin at the bottom of the symbol.
The data is written into the controllers memory by using the LcdWrite() method.

void LcdWrite(byte dc, byte data) {
  digitalWrite(PIN_DC, dc); //Data or Command?
  digitalWrite(PIN_SCE, LOW); //Enable chip
  shiftOut(PIN_SDIN, PIN_SCLK, MSBFIRST, data); //Shift data bit by bit, most significant bit first
  digitalWrite(PIN_SCE, HIGH); //Disable chip

The first parameter defines whether  the passed data is a command for the controller or just data to be written into the memory (like a single character). After the DC pin is set to HIGH or LOW and the chip is enabled to receive data, the actual data transfer starts. The data is shifted bit by bit into the memory of the controller starting with the most significant bit (MSB). That means the the first bit (from left) is put into the memory first. This pixel will be passed bit after bit into the last column of the 5×7 matrix. Have a look at the above picture to understand that fact.

The method LcdCharacter() does exactly the same for every byte (row of data) for an defined ASCII character of the already mentioned array.

void LcdCharacter(char character) {
  LcdWrite(LCD_D, 0x00); //Writes empty row
  for (int index = 0; index < 5; index++) {
    LcdWrite(LCD_D, ASCII[character - 0x20][index]); //Finds the passed character in the ASCII array and writes it row by row (byte by byte)
  LcdWrite(LCD_D, 0x00); //Writes empty row

That’s all. I hope I could help to set your Nokia 5110 display up and run it with your Arduino.


3 thoughts on “[Arduino] Connecting a Nokia 5110 display to Arduino – Part3: 5×7 bit ASCII representation

  1. Pingback: [Arduino] Connecting a Nokia 5110 display to Arduino « HelpFactory

  2. john bower says:

    Sorry the comment is not in German, but this is a eally good tutorial. I am like yourself, not really an expert on some of these things. I Recieved the 16 button and display kit from Itead studio, but their code was not very well documented, so it makes it difficult to figure out how to do anything but run that exact code. Very nice work., Thank you.

  3. Pingback: Kickstarter: Global radiation monitoring network « PocketMagic

Leave a Reply


You are commenting using your account. Log Out / Change )

Twitter picture


Facebook photo


Google+ photo


Connecting to %s