Spread the love

Dot Matrix LED Display multiplexing Matrix

____________________________________________________________________________________________________


Introduction

An LED dot matrix display multiplexing consists of a matrix of LED’s arranged in a rectangular fashion. The desired character or graphics can be displayed by switching ON /OFF a desired fashion of LED’s. Common display fashion available are 7×5, 8×8, 7×15, etc. LED dot matrix can be used in simple display applications where the resolution is not a big concern. The figure below shows the arrangement of LEDs in a typical 8×8 dot matrix display.

LED_Matrix

WORKING OF A SINGLE LED

electronics_led_diagram with led output

We all know that led  only glow when it is in forward bias. In the above fig we provide different voltage combination on the terminals of led, notice that led glow only when a=1 and b=0, because in this case led is in forward bias. We use this concept in case of multiplexing of led.

Here you can find out how to drive an led dot matrix with 64 LEDs (8 rows by 8 columns – 8×8 display) or less e.g. 35 LEDs (7 rows by 5 columns – 5×7 dot matrix). However, the principle remains the same for larger displays, you may need more processing power and driver circuitry though.

Multiplexing

  • If you tried to drive 64 individual LEDs you would need 64 individual output pins (each led connected to a output pin on one side and ground on the other) Which is practically not efficient solution, so we use multiplexing of LED Matrix.
  • Multiplexing used to reduce the number of pins needed to drive an LED display. You can do this by splitting the 64 led display into 8 rows and 8 columns which lets you drive it using 8 row outputs and 8 column outputs. In fact the 8×8 led matrix block used here has all the leds arranged in this way already. See the below figure.
  •  Any individual LED or a group of LEDs in the matrix can be activated by switching the required number of rows and columns. For example, in the above figure if Row1 is made high and Column1 is made low, the top left LED (address R1C1) will glow. As a demonstration, lets see how we can display letter “R” using the LED Matrix display. 

 Displaying single character “R”

LED Matrix

Figure shows the working of led matrix. During multiplexing of led we only glow one row at a time but time delay is in micro-second. Our eyes doesn’t able to distinguish images until the time delay between images is greater than about 50 millisecond or one-twentieth of a second. This is known as persistence of vision. Due to persistence of vision we can see the combined image.

For the Display any character we have to assign rows & columns to the microcontroller pins. As you see in above first figure we assign eight rows (i.e. R1 to R8) and eight column (i.e. C1 to C8).

Step by step programming of led matrix

step by step programming of led mtrix

  • In step 1, to display “R” we design pattern of “R” according to LED on/off as you can see in above pic. So our first task is to turn OFF raw C1,C2,C3 and C4, and turn ON R1 so first four horizontal  LEDs lights up which you can see in above figure.
  • In step 2, after some delay we turn OFF C1 and C5, and turn ON R2, so second row’s 1st and 5th LEDs lights up which you can see in above figure.
  • In step 3, after some delay we turn OFF C1 and C5, and turn ON R3.
  • In step 4, after some delay we turn OFF C1,C2,C3 and C4, and turn ON R4.
  • In step 5, after some delay we turn OFF C1,C2 and C3 turn ON R5.
  • In step 6, after some delay we turn OFF C1 and C4, and turn ON R6.
  • In step 7, after some delay we turn OFF C1 and C5, and turn ON R7.

If we put the entire 7 step in a proper order with very small delay in a while loop, then we can see the R on LED Matrix. Here is the logic of code………….

while(1)
{
		C=0X0F;
		R=0X80;
		Delay();
		C=0X77;
		R=0X40;
		Delay();
		C=0X77;
		R=0X20;
		Delay();
		C=0X0F;
		R=0X10;
		Delay();
		C=0X1F;
		R=0X08;
		Delay();
		C=0X6F;
		R=0X04;
		Delay();
		C=0X77;
		R=0X02;
		Delay();

};

 

1.Circuit Diagram of Multiplexing of LED with ARM7 ( LPC2148 ) 

led multiplexing with arm 7 lpc2148

1. Program of Multiplexing of LED with ARM7 ( LPC2148 ) 

 

/******************************************************
www.firmcodes.com
DEVELOPED BY:- FIRMWARE DEVELOPER
WHAT PROGRAM DO:- This program display FIRMCODES on LED matrix 
 
******************************************************/

#include<lpc21xx.h>   // arm header file

/* codes to display on lcd  */
int ar[10][8]={
                {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80},
                {0x81,0x81,0x9d,0x87,0x87,0x9f,0x9f,0x9f},     //F
                {0X81,0X81,0XE7,0XE7,0XE7,0XE7,0X81,0X81},     //I
                {0X83,0X81,0X99,0X81,0X83,0X87,0X93,0X99},     //R
                {0X18,0X00,0X00,0X24,0X3C,0X3C,0X3C,0X3C},     //M
                {0X81,0X81,0X99,0X9F,0X9F,0X99,0X81,0X81},     //C
                {0XC3,0X81,0X99,0X99,0X99,0X99,0X81,0XC3},     //0
                {0X07,0X03,0X31,0X39,0X39,0X31,0X03,0X07},     //D
                {0X81,0X81,0X9F,0X87,0X87,0X9F,0X81,0X81},     //E
                {0X81,0X81,0X9D,0X87,0XE1,0XD9,0X81,0X81}      //S
		       };

void delay(unsigned int x,int y)
  {
      unsigned int i,j;
      for(i=0;i<x;i++)
          for(j=0;j<y;j++);
  }


void main()
{
	unsigned int select_word,display,repeat;
	PINSEL0 =0X00000000;       // select the GPIO mode of PORT0
	IO0DIR=0XFFFFFFFF;         //direction of PORT0 is selected as output 
	
  while(1)
	{
		delay(1000,100);  // halt some time
		for(select_word=1;select_word<10;select_word++)  // select the word to display
		{
			for(repeat=0;repeat<150;repeat++)      // repeat display upto 150 times so that the display is visible to us
			{
				for(display=0;display<8;display++)   //display the codes of each letter
				{
					IO0SET |=(ar[0][display]<<0);    
					IO0SET |=(ar[select_word][display]<<8);
					delay(10,10);
					IO0CLR |=(ar[0][display]<<0);
					IO0CLR |=(ar[select_word][display]<<8);
				}
			}
		}
	}
			

}

 

Suggested Reading