logo

Select Sidearea

Populate the sidearea with useful widgets. Itโ€™s simple to add images, categories, latest post, social media icon links, tag clouds, and more.
[email protected]
+1234567890
 

Driving 5 x 7 Matrix LED with C Programming 8051 Microcontroller

/************************************************
           * *example of driving 5 x 7 Matrix LEDs *
           * *
           * * Compiler : MIDE-51
           * *
************************************************/
#include < at89s51.h > /* Include 89s51 header file here            */
 char const pat[5]={ 0x3f, 0x02, 0x04, 0x02, 0x3f };
           void wait (void)
           { ; /* wait function */ 
           }
           void main( void )
           {
           unsigned char cnt, col;
           unsigned int i;
 P3 = 0; /* ZERO port_a & port P3 */
           P1 = 0;
 for( ;; )
           {
           col = 1;
           for (cnt=0;cnt<5;cnt++)
           {
           for(col = 0;col < 32;col<<=1;)
           {
           P1 = pat[cnt];
           P3 = col;
           for (i = 0; i < 10000; i++)
           { 
           wait(); /* delay for half second */ 
           }
           }
           }
           }
           }