Scanning 7-Segment and Push Button Part 1 8051 C Programming


/* Display Two 7 Segmen */
/* Compiler : MIDE-51 */

#include < at89C2051.h > /* Include 89C2051 header file */

char num[ ] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};

void wait (void) /* wait function */

{ ; }

void main( void ){

unsigned char cnt, right;

unsigned int i;

P1 = 0; /* ZERO port P1 & port P3 */

P3 = 0;

for( ;; ){

          for (right=0;right<3;right++)

         {

           P3 = right;

           for (cnt=0;cnt<10;cnt++)

           {

           P1 = num[cnt];

           for (i = 0; i < 10000; i++)

           {

           wait(); /* delay for half second */

           }

           }

           }

           }

           }

Sumber : MyTutorialCafe

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s