Partners

DigiSoft Pakistan is a proud partner of
DIY Projects‎ > ‎

5 x 7 dotmatrix LED Display



The Flexibility of having a vero-board included in the AVR Project Board make it ideal for developing code library for the basic building block of a big application. 5 x 7 Dot-matrix LED Display is one of the example.

Dot Matrix Display used in this example is a 7 Rows by 5 Column single colorLED Matrix Display. LEDs  in the Module is arranged in the way that the Row Lines are connected to the Cathodes of the LEDs and the Column Lines are connected to the Anodes. In order to display any character on the display specific pattern is required to be updated on Row lines while the column lines are to be scanned in a timely manner so that the scanning is not visible to the viewer. A timer is usually used to do it (Timer 0 is used in this example) to maintain the strict timing requirements.

 

In this example the Column Lines are connected to PORTB and Row Lines are connected to the PORTD.

 

Schematic and wiring to the Project Board are depicted in the pictures.

 

Schematic





Pictures






Code

 

 

//************************************************************

//

//  This program Displays a Character on 7x5 Dotmatix Display

//

//************************************************************

 

 

#include <avr/io.h>

#include <avr/interrupt.h>

#include "CharCode.h"

 

#define BitVal(x) (1<<(x))

 

unsigned char Flag;

unsigned long num;

 

void disp(unsigned char col, unsigned char num);

 

int main (void)

{

 

            TCCR0 = BitVal(CS01); //start Timer 0

            TCCR1A = 0;

            TCCR1B = BitVal(CS12) | BitVal(CS11);       //count incoming pulses

            //GICR |= BitVal(INT2);

            TIMSK |= BitVal(TOIE0); //Enable Timer 0 overflow interrupt

            DDRB = 0x1F;

            DDRD = 0xFF;

            sei();

 

            while(1){

            }

}

 

unsigned char ind;

 

SIGNAL (SIG_OVERFLOW0)

{

            disp(ind,  'A');

            ind++;

            ind = ind % 5;

}

 

void disp(unsigned char col, unsigned char num)

{

            PORTB = 0x0;

            PORTD = ~(chcode[(int)(num-32)*6+col] << 1);

            PORTB = 1 << col;

}


Last Updated: Feb-2009