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