mat2051.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 : SPJ 8051 C DEMO              * 
 *                                              *
 ************************************************/

#include   /* Include 8031 SFR definition header file */

unsigned char pat[5] = {0x3f,0x02,0x04,0x02,0x3f} ;

void main () {
   unsigned char cnt, col ;

   P1 = 0 ;     /* Initialize all P1 outputs to be zero   */
   P3 = 0;
   while(1) {
      col = 1 ;
      for (cnt = 0 ; cnt < 5 ; cnt ++ ) {
         for (col = 1 ; col < 32 ; col <<= 1) {
            P3 = col ;
            P1 = pat[cnt] ;
            delay_ms(1) ; // delay of 1 ms
         }
      }
   }
}
    

Navigation Bar

tech_support@blitzlogic.com