128x64 LCD Graphics Driver Design

Graphic Display Driver

Displaying graphics on the 128×64 range of displays is extremely simple. It requires a graphics driver, which reads the bitmap graphics data and displays it. In addition, another program is required to create the graphics data from the bitmap image file. In this article, I show how to make both to display a graphic symbol.

Here is a bit-mapped graphic I was able to create as an example. These displays are very clear and excellent for displaying symbols and logos. However, they are a nightmare to photograph from an angle.

Graphic Display

Graphic Symbol

This just shows an ancient Sanskrit symbol on the screen, which means peace, harmony, and good fortune. All the superstars have one of these drawn on them somewhere...

Graphic Display

Here is the display

Project Files

Main Programgraphic.c
My C Library128x64.c
My declarations and bitmap data array128x64.h
Optional AVR Studio 4 project filegraphic.aps
graphic-driver.zip 

Driver Code

  1: /*------------------------------------------
  2:  My driver copies the bit-mapped data
  3:  from pgmspace to the LCD data port
  4:  according to the geometry layout of the 
  5:  KS0108 based display.
  6: 
  7:  This is described on my personal
  8:  website at:
  9:  https://www.petervis.com
 10: -------------------------------------------*/
 11: 
 12: void Show (const char *data){
 13:  
 14:  unsigned int i;
 15:  page=0;
 16:  
 17:  for(i = 0; i < 1024 ;i++)
 18:  {
 19:  
 20:  if (column == 128) 
 21:  // When the end of line is reached,
 22:  // this part increments the page.
 23: 
 24:  {
 25:  
 26:  // This resets the column.
 27:  column = 0;
 28:  page++;
 29:  setNewPage(page);
 30:  }
 31:  
 32:  cSelect(column); 
 33:  // This toggles the controller chip
 34:  // select lines cs1 / cs2 depending
 35:  // upon the column number.The column
 36:  // variable is shared by many functions.
 37: 
 38:  DataMode();
 39:  // Prepare the mode to send a byte of data.
 40: 
 41:  dPort = pgm_read_byte(data++);
 42:  // Send data from ROM to the data port.
 43:  
 44:  LocknLoad();
 45:  // Load data and relatch
 46: 
 47:  
 48:  column++; 
 49:  // Increment to next column (maximum 128).
 50:  }
 51: }

Bitmap to Data Array Converter

This program, written in Visual Basic, will take any monochrome image file and produce a data array file. This data is in the format required by the graphics driver program, which reads it and displays the image on the LCD.

It converts a monochrome graphic image stored in a bit map file into a data array. Therefore, in a way, it is an extractor of bitmap data.

The data array is compatible for use with a 128×64 range of LCD modules. The program generates a bitmap_data.txt file, which contains the data array. Please use the following link for more information.

128x64 Bitmap to Data Array Converter

This Article Continues...

128x64 LCD
Programming the 128x64 LCD
KS0108 128x64 LCD Hardware Control
128x64 Timing and Modes
128x64 LCD Graphics Driver Design
128x64 ASCII Text Driver Design
128x64 Bar Graph