mat_89.c  



Example to drive 5 x 7 Matrix LED

/************************************************
 *                                              *
 *      COPYRIGHT (c) Blitzlogic Sdn. Bhd.      *
 *      Author : Abraham Wong 21/1/2000         *
 *                                              *
 *      example of driving 5 x 7 Matrix LEDs    *
 *                                              *
 * Compiler : KEIL 8051 C - 2K EVAL             * 
 *                                              *
 ************************************************/

     #include < at89C2051.h > /* Include 89C2051 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 */   
                    }
                }
            }
        }
    }


Navigation Bar

tech_support@blitzlogic.com