The LED matrix display consists of LEDs connected in a matrix format. Generally they are connected in 4X4 and 8X8 matrix.
For interfacing a 8X8 LED dot Matrix, which have eight row pins together and eight column pins together. we need two PORTS. One port for rows and other for the columns.
The steps are given below
1.The DDR registers of both the ports is to be made as output.
2. For selecting a row we give ‘1’ to that row pin and ‘0’ for deselecting that row.
3. For selecting a column we give ‘0’ to that column pin and ‘1’ for deselecting that column pin.
Thus if I want to glow the LED in row 2 and column 5,
We will write the code as:
DDRA=0xff; // declaring PORTA as output port for selecting rows
DDRB=0xff; // declaring PORTB as output port for selecting columns
while(1)
{
PORTA=0b00000010; //selecting row 2
PORTB=0b11101111; //selecting column 5
}
So for displaying a particular pattern you have to switch ON those LEDs which forms the pattern, at a rate that is undetectable by our eyes.
For Displaying an Alphabet A we will use the theory or Persistence of eye in which the glowing of LED in the Matrix will take so fast that it will appear “A” to us and the practical code of which is given below