A dot-matrix display is a display device used to display information on machines, clocks, railway departure indicators and many other devices requiring a simple display device of limited resolution.
The display consists of a dot matrix of lights or mechanical indicators arranged in a rectangular configuration (other shapes are also possible, although not common) such that by switching on or off selected lights, text or graphics can be displayed. A dot matrix controller converts instructions from a processor into signals which turns on or off lights in the matrix so that the required display is produced.

A dot Matrix is usually like this:

Dotmatrix Display
Dotmatrix Display

This simple Project interfaces dot matrix 16×8 with famous 8051 Microcontroller AT89C51 and shows scrolling Text “BRAVELEARN” on 3 16×8 dot matrix display’s with no extra IC’s, shift registers required.

Please see here how to interface LED with AT89C51 if you are new to 8051 Microcontroller.

Below the simulation of this simple project:

Simulation of Scrolling "BRAVELEARN" with 16x8 Dot Matrix
Simulation of Scrolling “BRAVELEARN” with 16×8 Dot Matrix

The above simulation now shows 2 AT89C51, the reason behind is because each microcontroller can’t handle no more than 2 Dot Matrix 16×8 due to port limitation that is why we have used two microcontrollers.

For Microcontroller labelling “Run Code 1” have a different code as shown below:

Code 1 for Microcontroller labelling “Run Code 1”:


#include reg51.h
#include bravelearn.h

unsigned int timecount; 
unsigned char cnta; 
unsigned char cntb; 


int a,b;


void main(void) 
{ 
  P1=0X00;
  TMOD=0x01; 
  TR0=1; 
  ET0=1; 
  EA=1; 
  while(1){
  a++;
  if(a==120)	   //controls time of scrolling
  a=0;	  
  for(b=0;b<=7000;b++) 
    {
	
	} }
} 
void t0(void) interrupt 1 using 0 
{ 
  TH0=(65536-3000)/256; 
  TL0=(65536-3000)%6; 
  P2=tab[cnta]; 
  P3=digittab[cntb][cnta+a]; 
  P1=digittab[cntb][cnta+a+8];
  cnta++; 
  if(cnta==8) 
    { 
      
	  cnta=0; 
   
					 }

}		   

Form Microcontroller labelling “Run Code 2” please use the following code:

Code 2 for Microcontroller labelling “Run Code 2”:


#include reg51.h
#include bravelearn.h

unsigned int timecount; 
unsigned char cnta; 
unsigned char cntb; 


int a,b;


void main(void) 
{ 
  P1=0X00;
  TMOD=0x01; 
  TR0=1; 
  ET0=1; 
  EA=1; 
  while(1){
  a++;
  if(a==120)		   //controls time of scrolling
  a=0;	  
  for(b=0;b<=7000;b++) 
    {
	
	} }
} 
void t0(void) interrupt 1 using 0 
{ 
  TH0=(65536-3000)/256; 
  TL0=(65536-3000)%6; 
  P2=tab[cnta]; 
  P1=digittab[cntb][cnta+a+16];
  cnta++; 
  if(cnta==8) 
    { 
      
	  cnta=0; 
   
					 }

}		   

Create HEX file using both of these codes for each Microcontroller.

As we said earlier each Microcontroller have a capacity of running at least 2 Dot Matrix 16×8. But in the above simulation we have used 2 Microcontroller and 3 Dot Matrix. So, its up to you try attaching 4th Matrix and configure it in the code.

Also in the above codes we have used a library called ‘bravelearn.h’. I want to tell you that there is no such library so you might get run into errors if you try running this program. As we have learned in C/C++ you can create your own libraries. So, create a file in the notepad and name it as ‘bravelearn.h’ without quotes and place the following code in it:


unsigned char code tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; 
unsigned char code digittab[34][8]={{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
				    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
				    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
                                    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 
                                    {0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00, 0x00}, //B 
				    {0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, 0x00, 0x00}, //R
                                    {0x7E, 0x11, 0x11, 0x11, 0x7e, 0x00, 0x00, 0x00}, //A
				    {0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, 0x00, 0x00}, //V
                                    {0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, 0x00, 0x00}, //E 
				    {0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00}, //L
                                    {0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, 0x00, 0x00}, //E
                                    {0x7E, 0x11, 0x11, 0x11, 0x7e, 0x00, 0x00, 0x00}, //A
				    {0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, 0x00, 0x00}, //R
				    {0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, 0x00, 0x00}, //N
				    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
				    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
				    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
				    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //blank space
                                    }; 

The above codes displays the characters “BRAVELEARN” you may wanna change it as per your requirements. The above code uses suitable format readable by Microcontroller to displays these characters on a Dot Matrix. You may wanna use different characters and the list of all 26 letters is given below:


                                    {0x7E, 0x11, 0x11, 0x11, 0x7e, 0x00, 0x00, 0x00}, //A 
                                    {0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00, 0x00}, //B 
                                    {0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, 0x00, 0x00}, //C 
                                    {0x7F, 0x41, 0x41, 0x22, 0x1C, 0x00, 0x00, 0x00}, //D 
                                    {0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, 0x00, 0x00}, //E 
                                    {0x7F, 0x09, 0x09, 0x01, 0x01, 0x00, 0x00, 0x00}, //F
                                    {0x3E, 0x41, 0x41, 0x51, 0x32, 0x00, 0x00, 0x00}, //G 
                                    {0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, 0x00, 0x00}, //H 
                                    {0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, 0x00, 0x00}, //I
                                    {0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, 0x00, 0x00}, //J
				    {0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00}, //K
				    {0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00}, //L
				    {0x7F, 0x02, 0x04, 0x02, 0x7F, 0x00, 0x00, 0x00}, //M
				    {0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, 0x00, 0x00}, //N
				    {0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, 0x00, 0x00}, //O
				    {0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, 0x00, 0x00}, //P
				    {0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, 0x00, 0x00}, //Q
				    {0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, 0x00, 0x00}, //R
				    {0x46, 0x49, 0x49, 0x49, 0x31, 0x00, 0x00, 0x00}, //S
				    {0x01, 0x01, 0x7F, 0x01, 0x01, 0x00, 0x00, 0x00}, //T
				    {0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, 0x00, 0x00}, //U
				    {0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, 0x00, 0x00}, //V
				    {0x7F, 0x20, 0x18, 0x20, 0x7F, 0x00, 0x00, 0x00}, //W
				    {0x63, 0x14, 0x08, 0x14, 0x63, 0x00, 0x00, 0x00}, //X
				    {0x03, 0x04, 0x78, 0x04, 0x03, 0x00, 0x00, 0x00}, //Y
				    {0x61, 0x51, 0x49, 0x45, 0x43, 0x00, 0x00, 0x00}, //Z

You can modify the library ‘bravelearn.h’ using the above characters code. So, Good Luck! running this project 🙂

If you have any suggestions or questions leave us a comment below: