Tutorial Microcontroller MCS-51 ATMEL ISP

Pelatihan Mikrokontroller

 

Microcontroller Kits

Programmer and Target 89s51

Simple Mikrokontroller 89s51 Trainer


Standart
Mikrokontroller 89s51 Trainer

Super Mikrokontroller Trainer 89s51

 

 

 

BACK

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 */ 
           }
           }
           }
           }
           }
     

Comments, questions and discussion about this topic

BACK