Dot Matrix Display(Animation)

displaying message in dot matrix is quit interesting, the use of dot matrix are common these days. you can see it in many areas ,buses and metro are example of these field. we are going to introduce some effect in our project by creating pattern(smiley). it's recommended to read DOT MATRIX tutorial before proceeding further.

PROTEUS DESIGN

here in our design 8x8 dot matrix being used for displaying smiley :-). port P2 is treated as cathode starting from P2.7 as row1 to P2.0 as row8. similarly port P3 is treated as anode starting from P3.7 as col1 to P3.0 as col8.

CODE

 suppose we want to construct a pattern as shown in design above . for this we have to set a row and sending data to corresponding column. in similar manner by sending data row by row we can design complete pattern. considering P2 as cathode and P3 as anode row is connected to port2 and column with port3.

for turning leds 2,3,4 and 5 of 2nd row we need to assign port as

P2=0b00000010=~(0x40) //selecting 2nd row

P3=0b 00111100=0x3c //1 for turning leds on in that row

 

complete code

#include<reg51.h>
void smily_matrix();                   // complete pattern
void circle_matrix();                  // design circle
void eye_matrix();                   // eyes
void delay(unsigned char count)
{
    int i;
    unsigned char x;
    for(x=0;x<count;x++)
        for(i=0;i<1275;i++);
}
void main()
{
    while(1)   // infinite loop
    {
     circle_matrix();
     delay(5);
     eye_matrix();
     delay(5);
     smily_matrix();
     delay(5);     
    }
}
/* 
P2->cathodes 
P3->anodes 
*/
void circle_matrix()
{
P2= ~(0x40);   // selecting row
P3= 0x3c;      // turn on led on that row
delay(1);
P2= ~(0x20);
P3= 0x5a;    
delay(1);
P2= ~(0x10);
P3= 0x42;    
delay(1);
P2= ~(0x08);
P3= 0x42;    
delay(1);
P2= ~(0x04);
P3= 0x42;    
delay(1);
P2= ~(0x02);
P3= 0x3c;    
delay(1);
}
void eye_matrix()
{
P2= ~(0x40);
P3= 0x3c;    
delay(1);
P2= ~(0x20);
P3= 0x5a;    
delay(1);
P2= ~(0x10);
P3= 0x42;    
delay(1);
P2= ~(0x08);
P3= 0x66;    
delay(1);
P2= ~(0x04);
P3= 0x5a;    
delay(1);
P2= ~(0x02);
P3= 0x3c;    
delay(1);
}
void smily_matrix()
{
P2= ~(0x40);
P3= 0x3c;    
delay(1);
P2= ~(0x20);
P3= 0x5a;    
delay(1);
P2= ~(0x10);
P3= 0x42;    
delay(1);
P2= ~(0x08);
P3= 0x66;    
delay(1);
P2= ~(0x04);
P3= 0x5a;    
delay(1);
P2= ~(0x02);
P3= 0x3c;    
delay(1);
}

VIDEO

Category: 

Share

Who's new

  • ravirajpatil871...
  • shubhambajoria
  • yassir
  • demiholyman890954
  • scottgillum51169040

Get Notified

 

Share

We are Social

Syndicate

Subscribe to Syndicate