Sunteți pe pagina 1din 1

/* BLINKY.C - LED Flasher for the Keil MCBx51 Evaluation Board with 80C51 device */ #include <REG51F.

H> void wait (void) { ; } void main (void) { unsigned int i; unsigned char j; /* wait function */ /* only to delay for LED flashes */

/* Delay var */ /* LED var */ Loop forever */ Blink LED 0, 1, 2, 3, 4, 5, 6 */ Output to LED Port */ Delay for 10000 Counts */ call wait function */

while (1) { /* for (j=0x01; j< 0x80; j<<=1) { /* P1 = j; /* for (i = 0; i < 10000; i++) { /* wait (); /* } } for (j=0x80; j> 0x01; j>>=1) { /* P1 = j; /* for (i = 0; i < 10000; i++) { /* wait (); /* } } } }

Blink LED Output to Delay for call wait

6, 5, 4, 3, 2, 1 */ LED Port */ 10000 Counts */ function */

S-ar putea să vă placă și