43 lines
585 B
C
43 lines
585 B
C
#include "reg51.h"
|
|
//#include <at89x51.h>
|
|
|
|
bit lightoff = 1;
|
|
bit lighton = 0;
|
|
|
|
char code LED_light[17] = {
|
|
~0x00,
|
|
~0x01,
|
|
~0x02,
|
|
~0x04,
|
|
~0x08,
|
|
~0x10,
|
|
~0x20,
|
|
~0x40,
|
|
~0x80,
|
|
~0x40,
|
|
~0x20,
|
|
~0x10,
|
|
~0x08,
|
|
~0x04,
|
|
~0x02,
|
|
~0x01
|
|
};
|
|
|
|
void delay_1500ms();
|
|
|
|
int main () {
|
|
P1 = 0xFF;
|
|
while (1)
|
|
// ********* ¹ê§@ LED *********
|
|
for(LED_mode = 0; LED_mode < 16; LED_mode++) {
|
|
P1 = LED_light[LED_mode];
|
|
}
|
|
delay_1500ms();
|
|
} // end of while(1)
|
|
} // end of main()
|
|
|
|
void delay_1500ms() {
|
|
unsigned short kk;
|
|
for (kk = 0; kk < 33000; kk++);
|
|
}
|