Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

How to display string on Graphics LCD using 8051 Microcontroller (AT89C52)- (Part 44/45)

By Himanshu Choudhary March 30, 2011

Simple operations with graphics LCD have been explained in the previous article. This article demonstrates the functionality of graphics LCD to display strings of different fonts. It explains the program to display strings in 8x8 and 5x7 fonts and also to scroll them vertically.

 


 

The Graphics LCD used here is JHD12864E. This LCD is divided into two parts which are controlled by two different controllers. Each of these parts is divided into rows and columns. For basic instructions and programming procedure, refer to interfacing Graphics LCD with 8051.
 
To display different font types, corresponding header files have been created. These header files contain the bitmap information of all alphabetic, numeric characters and symbols of a particular font. These header files are included into the main program. (The header file declarations are given in Code2)
 
The strings to be displayed are stored in a character array. These strings are passed as arguments to a user defined function. The bitmap information of each character is called through pointer from respective header file. This way the whole string can be displayed.
 
Code explanation:
Function puts1():
This function is used to display string (with character font 8×8) directly on LCD.
 
·      First, a column and a page numbers are passed as arguments through puts1() function in variables y and x respectively.
·      y and x are used to set column and page addresses in the function.
·      The pointer *str receives the string (to be displayed on LCD) from the main function.
·      Then each character from string is taken with the help of for loop:
for(i=0; str[i]!=0; i++)
{
    a = (*( str+i ));
}
·      The bitmap code of each character of the string is taken from the array character8x8. The array character8x8 is defined in header file named as <font.h>. This array contains the bitmap codes of all characters and these codes are arranged in the same order as in the ASCII table.
 
·      The condition[a*=8; ] is used to increase the address of the character in array character8x8 by 8 because the size of bitmap of each character is 8 bytes which needs to be skipped. This array is saved as code unsigned char. The unsigned char makes it an unsigned character array and the keyword code saves it to flash memory of microcontroller. Thus long arrays (which do not change in course of code) can be saved with small RAM of 8051 (here AT89C52 has been used which has 128 bytes of RAM and 8K bytes flash memory).
 
Function puts2():
This function is used to display string ((with character font 5×7) directly on LCD. This function works similar to puts1() function with slight differences which are explained below.
 
·      In the condition [ a=(*(str+i)-32); ], ‘32’ is subtracted because the ASCII value of the first character of array font5x7 is 32.
·      The condition [ a*=5;] is used because the bitmap size of each character is 5 bytes (and not 8 as earlier) which needs to be skipped.     

Scrolling the text:
To scroll the strings, the start line has to be selected. The following steps are to be followed to write startline function:
a)      Put these values in Data register
 
DB7
DB6
DB5
DB4
DB3
DB2
DB1
DB0
1
1
Z5
Z4
Z3
Z2
Z1
Z0
 
      b)      CS1=1, CS2=1 (display data on both halves of LCD)
       c)      RS=0, R/W=0 (to select the instruction mode)
       d)     EN=1
       e)      Delay
       f)       EN=0 (to latch data into the input register)
 
To scroll the strings vertically just pass the successive line values to the setstartline() function. This can be easily done using a while loop (see Code). To blink the display, just call the display off and display on functions successively with some delay. The connections of LCD with controller are shown in circuit diagram. Also see displaying images on Graphics LCD.

Project Source Code

###

/*Program to print text on Graphics LCD*/

#include<reg51.h>
#include<intrins.h>
#define dport P2
#include "font.h"
#include "font2.h"

sbit rs=P1^0;
sbit rw=P1^1;
sbit en=P1^2;
sbit cs1=P1^3;
sbit cs2=P1^4;

unsigned char c;
unsigned char z=0;

void ctrloff()
{
	rs=0;
	rw=0;
	en=0;
	cs1=0;
	cs2=0;
}

//DELAY FUNCTION
void delay(unsigned int j)
{
	unsigned int i;
	for(i=0;i<j;i++);
} 

void displayon()
{ 
	ctrloff();
	dport=0x3f;  
	cs1=1;cs2=1;
	rw=0;rs=0;
	en=1;
	_nop_();
	en=0;
}

void displayoff()
{
	ctrloff();
	dport=0x3e;
	cs1=1;cs2=1;
	rs=0;rw=0;
	en=1;
	_nop_();
	en=0;
}

void setcolumn(unsigned char y)
{
	if(y<64)
	{
		ctrloff();
		c=y;
		dport=0x40|(y&63);	  //0x40 represents Column 0
		cs1=1;cs2=0;
		rs=0;
		rw=0;
		en=1;
		_nop_();
		en=0;
	}
	else
	{ 
		c=y;
		dport=0x40|((y-64)&63);	  //0x40 represents Column 0
		cs2=1;cs1=0;
		rs=0;
		rw=0;
		en=1;
		_nop_();
		en=0;
	}
}

void setpage(unsigned char x)
{
	ctrloff();
	dport= 0xb8|x;	   //0xb8 represents Page 0
	cs1=1;
	cs2=1;
	rs=0;
	rw=0;
	en=1;
	_nop_();
	en=0;
}

//Function to Scroll Strings
void setstartline(unsigned char z)			 
{
	ctrloff();
	dport=0xc0|z;	   //0xc0 represents Line 0
	cs1=1;
	cs2=1;
	rs=0;
	rw=0;
	en=1;
	_nop_();
	en=0;					  
} 

void lcddata(unsigned char *value,unsigned int limit)
{
	unsigned int i;
	for(i=0;i<limit;i++)
	{
		if(c<64)
		{
			dport=value[i];
			cs1=1;cs2=0;
			rs=1;
			rw=0;
			en=1;
			_nop_();
			en=0	;
			c++;
		}
		else
		{ 
			setcolumn(c);
			dport=value[i];
			cs2=1;cs1=0;
			rs=1;
			rw=0;
			en=1;
			_nop_();
			en=0	;
			c++;
		}
		if(c>127)
		   return;
	}
}

void lcdputs1(unsigned char y,unsigned char x,unsigned char *str)
{
	unsigned char i;
	unsigned int a;
	setcolumn(y);
	setpage(x);
	for(i=0;str[i]!=0;i++)
	{
		a=(*(str+i));
		a*=8;
		lcddata(&Character8x8[a],8);
	}
}

void lcdputs2(unsigned char y,unsigned char x,unsigned char *str)
{
	unsigned char i;
	unsigned int a;
	setcolumn(y);
	setpage(x);
	for(i=0;str[i]!=0;i++)
	{
		a=(*(str+i)-32);
		a*=5;
		lcddata(&font5x7[a],5);
	}
}
void clrlcd()
{
    unsigned char i,j;
    for (i=0;i < 8;i++)
    {
	setpage(i);
	setcolumn(0);
        for (j= 0 ;j < 128; j++)
        lcddata(&z,1);
    }
}

unsigned char ar0[]="***************  ";
unsigned char ar1[]="ENGINEERSGARAGE";
unsigned char ar2[]="Inspiring Creations   ";                 
unsigned char ar3[]="**************  ";

void main()
{
	unsigned char i;
	clrlcd();
	displayon();
	setcolumn(0);
	setpage(0);
	lcdputs1(0,1,ar0);
	lcdputs1(0,2,ar1);
	lcdputs2(0,3,ar2);
	lcdputs1(0,4,ar3);
	delay(65000);
	delay(65000);
	for(i=0;i<5;i++)
	{
		displayoff();
		delay(65000);
		displayon();
		delay(65000);
		delay(65000);
	}
	i=0;
	while(1)
	{
		setstartline(i++);	 //Function to Scroll Strings
		delay(40000);
	}
} 

###


Project Source Code

###

/**************************************************************/
/************** FONT.H ****************************************/
/**************************************************************/
code unsigned char Character8x8[] = {
  0,   0,   0,   0,   0,   0,   0,   0,
126, 129, 149, 177, 177, 149, 129, 126,
126, 255, 235, 207, 207, 235, 255, 126,
 14,  31,  63, 126,  63,  31,  14,   0,
  8,  28,  62, 127,  62,  28,   8,   0,
 24, 186, 255, 255, 255, 186,  24,   0,
 16, 184, 252, 255, 252, 184,  16,   0,
  0,   0,  24,  60,  60,  24,   0,   0,
255, 255, 231, 195, 195, 231, 255, 255,
  0,  60, 102,  66,  66, 102,  60,   0,
255, 195, 153, 189, 189, 153, 195, 255,
112, 248, 136, 136, 253, 127,   7,  15,
  0,  78,  95, 241, 241,  95,  78,   0,
192, 224, 255, 127,   5,   5,   7,   7,
192, 255, 127,   5,   5, 101, 127,  63,
153,  90,  60, 231, 231,  60,  90, 153,
127,  62,  62,  28,  28,   8,   8,   0,
  8,   8,  28,  28,  62,  62, 127,   0,
  0,  36, 102, 255, 255, 102,  36,   0,
  0,  95,  95,   0,   0,  95,  95,   0,
  6,  15,   9, 127, 127,   1, 127, 127,
 64, 218, 191, 165, 253,  89,   3,   2,
  0, 112, 112, 112, 112, 112, 112,   0,
128, 148, 182, 255, 255, 182, 148, 128,
  0,   4,   6, 127, 127,   6,   4,   0,
  0,  16,  48, 127, 127,  48,  16,   0,
  8,   8,   8,  42,  62,  28,   8,   0,
  8,  28,  62,  42,   8,   8,   8,   0,
 60,  60,  32,  32,  32,  32,  32,   0,
  8,  28,  62,   8,   8,  62,  28,   8,
 48,  56,  60,  62,  62,  60,  56,  48,
  6,  14,  30,  62,  62,  30,  14,   6,
  0,   0,   0,   0,   0,   0,   0,   0,
  0,   6,  95,  95,   6,   0,   0,   0,
  0,   7,   7,   0,   7,   7,   0,   0,
 20, 127, 127,  20, 127, 127,  20,   0,
 36,  46, 107, 107,  58,  18,   0,   0,
 70, 102,  48,  24,  12, 102,  98,   0,
 48, 122,  79,  93,  55, 122,  72,   0,
  4,   7,   3,   0,   0,   0,   0,   0,
  0,  28,  62,  99,  65,   0,   0,   0,
  0,  65,  99,  62,  28,   0,   0,   0,
  8,  42,  62,  28,  28,  62,  42,   8,
  8,   8,  62,  62,   8,   8,   0,   0,
  0, 128, 224,  96,   0,   0,   0,   0,
  8,   8,   8,   8,   8,   8,   0,   0,
  0,   0,  96,  96,   0,   0,   0,   0,
 96,  48,  24,  12,   6,   3,   1,   0,
 62, 127, 113,  89,  77, 127,  62,   0,
 64,  66, 127, 127,  64,  64,   0,   0,
 98, 115,  89,  73, 111, 102,   0,   0,
 34,  99,  73,  73, 127,  54,   0,   0,
 24,  28,  22,  83, 127, 127,  80,   0,
 39, 103,  69,  69, 125,  57,   0,   0,
 60, 126,  75,  73, 121,  48,   0,   0,
  3,   3, 113, 121,  15,   7,   0,   0,
 54, 127,  73,  73, 127,  54,   0,   0,
  6,  79,  73, 105,  63,  30,   0,   0,
  0,   0, 102, 102,   0,   0,   0,   0,
  0, 128, 230, 102,   0,   0,   0,   0,
  8,  28,  54,  99,  65,   0,   0,   0,
 36,  36,  36,  36,  36,  36,   0,   0,
  0,  65,  99,  54,  28,   8,   0,   0,
  2,   3,  81,  89,  15,   6,   0,   0,
 62, 127,  65,  93,  93,  31,  30,   0,
124, 126,  19,  19, 126, 124,   0,   0,   
 65, 127, 127,  73,  73, 127,  54,   0,
 28,  62,  99,  65,  65,  99,  34,   0,
 65, 127, 127,  65,  99,  62,  28,   0,
 65, 127, 127,  73,  93,  65,  99,   0,
 65, 127, 127,  73,  29,   1,   3,   0,
 28,  62,  99,  65,  81, 115, 114,   0,
127, 127,   8,   8, 127, 127,   0,   0,
  0,  65, 127, 127,  65,   0,   0,   0,
 48, 112,  64,  65, 127,  63,   1,   0,
 65, 127, 127,   8,  28, 119,  99,   0,
 65, 127, 127,  65,  64,  96, 112,   0,
127, 127,  14,  28,  14, 127, 127,   0,
127, 127,   6,  12,  24, 127, 127,   0,
 28,  62,  99,  65,  99,  62,  28,   0,
 65, 127, 127,  73,   9,  15,   6,   0,
 30,  63,  33, 113, 127,  94,   0,   0,
 65, 127, 127,   9,  25, 127, 102,   0,
 38, 111,  77,  89, 115,  50,   0,   0,
  3,  65, 127, 127,  65,   3,   0,   0,
127, 127,  64,  64, 127, 127,   0,   0,
 31,  63,  96,  96,  63,  31,   0,   0,
127, 127,  48,  24,  48, 127, 127,   0,
 67, 103,  60,  24,  60, 103,  67,   0,
  7,  79, 120, 120,  79,   7,   0,   0,
 71,  99, 113,  89,  77, 103, 115,   0,
  0, 127, 127,  65,  65,   0,   0,   0,
  1,   3,   6,  12,  24,  48,  96,   0,
  0,  65,  65, 127, 127,   0,   0,   0,
  8,  12,   6,   3,   6,  12,   8,   0,
128, 128, 128, 128, 128, 128, 128, 128,
  0,   0,   3,   7,   4,   0,   0,   0,
 32, 116,  84,  84,  60, 120,  64,   0,
 65, 127,  63,  72,  72, 120,  48,   0,
 56, 124,  68,  68, 108,  40,   0,   0,
 48, 120,  72,  73,  63, 127,  64,   0,
 56, 124,  84,  84,  92,  24,   0,   0,
 72, 126, 127,  73,   3,   2,   0,   0,
152, 188, 164, 164, 248, 124,   4,   0,
 65, 127, 127,   8,   4, 124, 120,   0,
  0,  68, 125, 125,  64,   0,   0,   0,
 96, 224, 128, 128, 253, 125,   0,   0,
 65, 127, 127,  16,  56, 108,  68,   0,
  0,  65, 127, 127,  64,   0,   0,   0,
124, 124,  24,  56,  28, 124, 120,   0,
124, 124,   4,   4, 124, 120,   0,   0,
 56, 124,  68,  68, 124,  56,   0,   0,
132, 252, 248, 164,  36,  60,  24,   0,
 24,  60,  36, 164, 248, 252, 132,   0,
 68, 124, 120,  76,   4,  28,  24,   0,
 72,  92,  84,  84, 116,  36,   0,   0,
  0,   4,  62, 127,  68,  36,   0,   0,
 60, 124,  64,  64,  60, 124,  64,   0,
 28,  60,  96,  96,  60,  28,   0,   0,
 60, 124, 112,  56, 112, 124,  60,   0,
 68, 108,  56,  16,  56, 108,  68,   0,
156, 188, 160, 160, 252, 124,   0,   0,
 76, 100, 116,  92,  76, 100,   0,   0,
  8,   8,  62, 119,  65,  65,   0,   0,
  0,   0,   0, 119, 119,   0,   0,   0,
 65,  65, 119,  62,   8,   8,   0,   0,
  2,   3,   1,   3,   2,   3,   1,   0,
112, 120,  76,  70,  76, 120, 112,   0,
 14, 159, 145, 177, 251,  74,   0,   0,
 58, 122,  64,  64, 122, 122,  64,   0,
 56, 124,  84,  85,  93,  25,   0,   0,
  2,  35, 117,  85,  85, 125, 123,  66,
 33, 117,  84,  84, 125, 121,  64,   0,
 33, 117,  85,  84, 124, 120,  64,   0,
 32, 116,  87,  87, 124, 120,  64,   0,
 24,  60, 164, 164, 228,  64,   0,   0,
  2,  59, 125,  85,  85,  93,  27,   2,
 57, 125,  84,  84,  93,  25,   0,   0,
 57, 125,  85,  84,  92,  24,   0,   0,
  1,  69, 124, 124,  65,   1,   0,   0,
  2,   3,  69, 125, 125,  67,   2,   0,
  1,  69, 125, 124,  64,   0,   0,   0,
121, 125,  22,  18,  22, 125, 121,   0,
112, 120,  43,  43, 120, 112,   0,   0,
 68, 124, 124,  85,  85,  69,   0,   0,
 32, 116,  84,  84, 124, 124,  84,  84,
124, 126,  11,   9, 127, 127,  73,   0,
 50, 123,  73,  73, 123,  50,   0,   0,
 50, 122,  72,  72, 122,  50,   0,   0,
 50, 122,  74,  72, 120,  48,   0,   0,
 58, 123,  65,  65, 123, 122,  64,   0,
 58, 122,  66,  64, 120, 120,  64,   0,
154, 186, 160, 160, 250, 122,   0,   0,
  1,  25,  60, 102, 102,  60,  25,   1,
 61, 125,  64,  64, 125,  61,   0,   0,
 24,  60,  36, 231, 231,  36,  36,   0,
104, 126, 127,  73,  67, 102,  32,   0,
 43,  47, 252, 252,  47,  43,   0,   0,
255, 255,   9,   9,  47, 246, 248, 160,
 64, 192, 136, 254, 127,   9,   3,   2,
 32, 116,  84,  85, 125, 121,  64,   0,
  0,  68, 125, 125,  65,   0,   0,   0,
 48, 120,  72,  74, 122,  50,   0,   0,
 56, 120,  64,  66, 122, 122,  64,   0,
122, 122,  10,  10, 122, 112,   0,   0,
125, 125,  25,  49, 125, 125,   0,   0,
  0,  38,  47,  41,  47,  47,  40,   0,
  0,  38,  47,  41,  47,  38,   0,   0,
 48, 120,  77,  69,  96,  32,   0,   0,
 56,  56,   8,   8,   8,   8,   0,   0,
  8,   8,   8,   8,  56,  56,   0,   0,
 79, 111,  48,  24, 204, 238, 187, 145,
 79, 111,  48,  24, 108, 118, 251, 249,
  0,   0,   0, 123, 123,   0,   0,   0,
  8,  28,  54,  34,   8,  28,  54,  34,
 34,  54,  28,   8,  34,  54,  28,   8,
170,   0,  85,   0, 170,   0,  85,   0,
170,  85, 170,  85, 170,  85, 170,  85,
221, 255, 170, 119, 221, 170, 255, 119,
  0,   0,   0, 255, 255,   0,   0,   0,
 16,  16,  16, 255, 255,   0,   0,   0,
 20,  20,  20, 255, 255,   0,   0,   0,
 16,  16, 255, 255,   0, 255, 255,   0,
 16,  16, 240, 240,  16, 240, 240,   0,
 20,  20,  20, 252, 252,   0,   0,   0,
 20,  20, 247, 247,   0, 255, 255,   0,
  0,   0, 255, 255,   0, 255, 255,   0,
 20,  20, 244, 244,   4, 252, 252,   0,
 20,  20,  23,  23,  16,  31,  31,   0,
 16,  16,  31,  31,  16,  31,  31,   0,
 20,  20,  20,  31,  31,   0,   0,   0,
 16,  16,  16, 240, 240,   0,   0,   0,
  0,   0,   0,  31,  31,  16,  16,  16,
 16,  16,  16,  31,  31,  16,  16,  16,
 16,  16,  16, 240, 240,  16,  16,  16,
  0,   0,   0, 255, 255,  16,  16,  16,
 16,  16,  16,  16,  16,  16,  16,  16,
 16,  16,  16, 255, 255,  16,  16,  16,
  0,   0,   0, 255, 255,  20,  20,  20,
  0,   0, 255, 255,   0, 255, 255,  16,
  0,   0,  31,  31,  16,  23,  23,  20,
  0,   0, 252, 252,   4, 244, 244,  20,
 20,  20,  23,  23,  16,  23,  23,  20,
 20,  20, 244, 244,   4, 244, 244,  20,
  0,   0, 255, 255,   0, 247, 247,  20,
 20,  20,  20,  20,  20,  20,  20,  20,
 20,  20, 247, 247,   0, 247, 247,  20,
 20,  20,  20,  23,  23,  20,  20,  20,
 16,  16,  31,  31,  16,  31,  31,  16,
 20,  20,  20, 244, 244,  20,  20,  20,
 16,  16, 240, 240,  16, 240, 240,  16,
  0,   0,  31,  31,  16,  31,  31,  16,
  0,   0,   0,  31,  31,  20,  20,  20,
  0,   0,   0, 252, 252,  20,  20,  20,
  0,   0, 240, 240,  16, 240, 240,  16,
 16,  16, 255, 255,  16, 255, 255,  16,
 20,  20,  20, 255, 255,  20,  20,  20,
 16,  16,  16,  31,  31,   0,   0,   0,
  0,   0,   0, 240, 240,  16,  16,  16,
255, 255, 255, 255, 255, 255, 255, 255,
240, 240, 240, 240, 240, 240, 240, 240,
255, 255, 255, 255,   0,   0,   0,   0,
  0,   0,   0,   0, 255, 255, 255, 255,
 15,  15,  15,  15,  15,  15,  15,  15,
 56, 124,  68, 108,  56, 108,  68,   0,
252, 254,  42,  42,  62,  20,   0,   0,
126, 126,   2,   2,   6,   6,   0,   0,
  2, 126, 126,   2, 126, 126,   2,   0,
 99, 119,  93,  73,  99,  99,   0,   0,
 56, 124,  68, 124,  60,   4,   4,   0,
128, 254, 126,  32,  32,  62,  30,   0,
  4,   6,   2, 126, 124,   6,   2,   0,
153, 189, 231, 231, 189, 153,   0,   0,
 28,  62, 107,  73, 107,  62,  28,   0,
 76, 126, 115,   1, 115, 126,  76,   0,
 48, 120,  74,  79, 125,  57,   0,   0,
 24,  60,  36,  60,  60,  36,  60,  24,
152, 252, 100,  60,  62,  39,  61,  24,
 28,  62, 107,  73,  73,   0,   0,   0,
126, 127,   1,   1, 127, 126,   0,   0,
 42,  42,  42,  42,  42,  42,   0,   0,
 68,  68,  95,  95,  68,  68,   0,   0,
 64,  81,  91,  78,  68,  64,   0,   0,
 64,  68,  78,  91,  81,  64,   0,   0,
  0,   0,   0, 254, 255,   1,   7,   6,
 96, 224, 128, 255, 127,   0,   0,   0,
  8,   8, 107, 107,   8,   8,   0,   0,
 36,  54,  18,  54,  36,  54,  18,   0,
  0,   6,  15,   9,  15,   6,   0,   0,
  0,   0,   0,  24,  24,   0,   0,   0,
  0,   0,   0,  16,  16,   0,   0,   0,
 16,  48, 112, 192, 255, 255,   1,   1,
  0,  31,  31,   1,  31,  30,   0,   0,
  0,  25,  29,  23,  18,   0,   0,   0,
  0,   0,  60,  60,  60,  60,   0,   0,
  0,   0,   0,   0,   0,   0,   0,   0
};


/**************************************************************/
/************** FONT2.H ***************************************/
/**************************************************************/
code unsigned char font5x7[] = {
0x00, 0x00, 0x00, 0x00, 0x00,// (space)
0x00, 0x00, 0x5F, 0x00, 0x00,// !
0x00, 0x07, 0x00, 0x07, 0x00,// "
0x14, 0x7F, 0x14, 0x7F, 0x14,// #
0x24, 0x2A, 0x7F, 0x2A, 0x12,// $
0x23, 0x13, 0x08, 0x64, 0x62,// %
0x36, 0x49, 0x55, 0x22, 0x50,// &
0x00, 0x05, 0x03, 0x00, 0x00,// '
0x00, 0x1C, 0x22, 0x41, 0x00,// (
0x00, 0x41, 0x22, 0x1C, 0x00,// )
0x08, 0x2A, 0x1C, 0x2A, 0x08,// *
0x08, 0x08, 0x3E, 0x08, 0x08,// +
0x00, 0x50, 0x30, 0x00, 0x00,// ,
0x08, 0x08, 0x08, 0x08, 0x08,// -
0x00, 0x30, 0x30, 0x00, 0x00,// .
0x20, 0x10, 0x08, 0x04, 0x02,// /
0x3E, 0x51, 0x49, 0x45, 0x3E,// 0
0x00, 0x42, 0x7F, 0x40, 0x00,// 1
0x42, 0x61, 0x51, 0x49, 0x46,// 2
0x21, 0x41, 0x45, 0x4B, 0x31,// 3
0x18, 0x14, 0x12, 0x7F, 0x10,// 4
0x27, 0x45, 0x45, 0x45, 0x39,// 5
0x3C, 0x4A, 0x49, 0x49, 0x30,// 6
0x01, 0x71, 0x09, 0x05, 0x03,// 7
0x36, 0x49, 0x49, 0x49, 0x36,// 8
0x06, 0x49, 0x49, 0x29, 0x1E,// 9
0x00, 0x36, 0x36, 0x00, 0x00,// :
0x00, 0x56, 0x36, 0x00, 0x00,// ;
0x00, 0x08, 0x14, 0x22, 0x41,// <
0x14, 0x14, 0x14, 0x14, 0x14,// =
0x41, 0x22, 0x14, 0x08, 0x00,// >
0x02, 0x01, 0x51, 0x09, 0x06,// ?
0x32, 0x49, 0x79, 0x41, 0x3E,// @
0x7E, 0x11, 0x11, 0x11, 0x7E,// A
0x7F, 0x49, 0x49, 0x49, 0x36,// B
0x3E, 0x41, 0x41, 0x41, 0x22,// C
0x7F, 0x41, 0x41, 0x22, 0x1C,// D
0x7F, 0x49, 0x49, 0x49, 0x41,// E
0x7F, 0x09, 0x09, 0x01, 0x01,// F
0x3E, 0x41, 0x41, 0x51, 0x32,// G
0x7F, 0x08, 0x08, 0x08, 0x7F,// H
0x00, 0x41, 0x7F, 0x41, 0x00,// I
0x20, 0x40, 0x41, 0x3F, 0x01,// J
0x7F, 0x08, 0x14, 0x22, 0x41,// K
0x7F, 0x40, 0x40, 0x40, 0x40,// L
0x7F, 0x02, 0x04, 0x02, 0x7F,// M
0x7F, 0x04, 0x08, 0x10, 0x7F,// N
0x3E, 0x41, 0x41, 0x41, 0x3E,// O
0x7F, 0x09, 0x09, 0x09, 0x06,// P
0x3E, 0x41, 0x51, 0x21, 0x5E,// Q
0x7F, 0x09, 0x19, 0x29, 0x46,// R
0x46, 0x49, 0x49, 0x49, 0x31,// S
0x01, 0x01, 0x7F, 0x01, 0x01,// T
0x3F, 0x40, 0x40, 0x40, 0x3F,// U
0x1F, 0x20, 0x40, 0x20, 0x1F,// V
0x7F, 0x20, 0x18, 0x20, 0x7F,// W
0x63, 0x14, 0x08, 0x14, 0x63,// X
0x03, 0x04, 0x78, 0x04, 0x03,// Y
0x61, 0x51, 0x49, 0x45, 0x43,// Z
0x00, 0x00, 0x7F, 0x41, 0x41,// [
0x02, 0x04, 0x08, 0x10, 0x20,// ""
0x41, 0x41, 0x7F, 0x00, 0x00,// ]
0x04, 0x02, 0x01, 0x02, 0x04,// ^
0x40, 0x40, 0x40, 0x40, 0x40,// _
0x00, 0x01, 0x02, 0x04, 0x00,// `
0x20, 0x54, 0x54, 0x54, 0x78,// a
0x7F, 0x48, 0x44, 0x44, 0x38,// b
0x38, 0x44, 0x44, 0x44, 0x20,// c
0x38, 0x44, 0x44, 0x48, 0x7F,// d
0x38, 0x54, 0x54, 0x54, 0x18,// e
0x08, 0x7E, 0x09, 0x01, 0x02,// f
0x08, 0x14, 0x54, 0x54, 0x3C,// g
0x7F, 0x08, 0x04, 0x04, 0x78,// h
0x00, 0x44, 0x7D, 0x40, 0x00,// i
0x20, 0x40, 0x44, 0x3D, 0x00,// j
0x00, 0x7F, 0x10, 0x28, 0x44,// k
0x00, 0x41, 0x7F, 0x40, 0x00,// l
0x7C, 0x04, 0x18, 0x04, 0x78,// m
0x7C, 0x08, 0x04, 0x04, 0x78,// n
0x38, 0x44, 0x44, 0x44, 0x38,// o
0x7C, 0x14, 0x14, 0x14, 0x08,// p
0x08, 0x14, 0x14, 0x18, 0x7C,// q
0x7C, 0x08, 0x04, 0x04, 0x08,// r
0x48, 0x54, 0x54, 0x54, 0x20,// s
0x04, 0x3F, 0x44, 0x40, 0x20,// t
0x3C, 0x40, 0x40, 0x20, 0x7C,// u
0x1C, 0x20, 0x40, 0x20, 0x1C,// v
0x3C, 0x40, 0x30, 0x40, 0x3C,// w
0x44, 0x28, 0x10, 0x28, 0x44,// x
0x0C, 0x50, 0x50, 0x50, 0x3C,// y
0x44, 0x64, 0x54, 0x4C, 0x44,// z
0x00, 0x08, 0x36, 0x41, 0x00,// {
0x00, 0x00, 0x7F, 0x00, 0x00,// |
0x00, 0x41, 0x36, 0x08, 0x00,// }
};

###


Circuit Diagrams

Circuit-Diagram-Displaying-String-Graphics-LCD-8051-Microcontroller-AT89C52

Project Components

  • AT89C52 Microcontroller
  • Graphics LCD

Project Video


Filed Under: 8051 Microcontroller
Tagged With: 8051, graphics, lcd, microcontroller
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • BF999 Input and output impedance
  • floating node warning in LTSpice
  • Electrochemical Front End do we need dual voltage rails and split ground
  • How best to synchronise the UCC38C45?
  • Driving hi side Full Bridge FETs with a HV Bootstrap IC?

RSS Electro-Tech-Online.com Discussions

  • How to make string LEDs?
  • PIC KIT 3 not able to program dsPIC
  • Display TFT ST7789 (OshonSoft Basic).
  • Remote Control By Location Part 2
  • Raise your hand if your car had one of these:

Featured – LoRa/LoRaWan Series

  • What is the LoRaWAN network and how does it work?
  • Understanding LoRa architecture: nodes, gateways, and servers
  • Revolutionizing RF: LoRa applications and advantages
  • How to build a LoRa gateway using Raspberry Pi
  • How LoRa enables long-range communication
  • How communication works between two LoRa end-node devices

Recent Articles

  • Nordic PMIC features 8 µA fuel gauging for small battery devices
  • Harwin upgrades cable configurator with 3D rendering and PDF drawing generation
  • Infineon ID key S USB combines security controller with USB bridge
  • Renesas MCU features 64 MHz Cortex-M23 Core with 3-channel sample-and-hold
  • How to monitor temperature and humidity on a TFT display with graphics

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe