first commit
This commit is contained in:
73
led.c
Normal file
73
led.c
Normal file
@ -0,0 +1,73 @@
|
||||
#include "reg51.h"
|
||||
//#include <at89x51.h>
|
||||
|
||||
bit lightoff = 1;
|
||||
bit lighton = 0;
|
||||
sbit P1_0 = P1^0;
|
||||
sbit P1_1 = P1^1;
|
||||
sbit P1_2 = P1^2;
|
||||
sbit P1_3 = P1^3;
|
||||
sbit P1_4 = P1^4;
|
||||
sbit P1_5 = P1^5;
|
||||
sbit P1_6 = P1^6;
|
||||
sbit P1_7 = P1^7;
|
||||
void delay_1500ms();
|
||||
|
||||
int main () {
|
||||
P1 = 0xFF;
|
||||
while (1) {
|
||||
delay_1500ms();
|
||||
|
||||
P1_0 = lighton;
|
||||
delay_1500ms();
|
||||
|
||||
P1_1 = lighton;
|
||||
delay_1500ms();
|
||||
|
||||
P1_2 = lighton;
|
||||
delay_1500ms();
|
||||
|
||||
P1_3 = lighton;
|
||||
delay_1500ms();
|
||||
|
||||
P1_4 = lighton;
|
||||
delay_1500ms();
|
||||
|
||||
P1_5 = lighton;
|
||||
delay_1500ms();
|
||||
|
||||
P1_6 = lighton;
|
||||
delay_1500ms();
|
||||
|
||||
P1_7 = lighton;
|
||||
delay_1500ms();
|
||||
|
||||
P1_7 = lightoff;
|
||||
delay_1500ms();
|
||||
|
||||
P1_6 = lightoff;
|
||||
delay_1500ms();
|
||||
|
||||
P1_5 = lightoff;
|
||||
delay_1500ms();
|
||||
|
||||
P1_4 = lightoff;
|
||||
delay_1500ms();
|
||||
|
||||
P1_3 = lightoff;
|
||||
delay_1500ms();
|
||||
|
||||
P1_2 = lightoff;
|
||||
delay_1500ms();
|
||||
|
||||
P1_1 = lightoff;
|
||||
delay_1500ms();
|
||||
|
||||
P1_0 = lightoff;
|
||||
} // end of while(1)
|
||||
} // end of main()
|
||||
|
||||
void delay_1500ms() {
|
||||
unsigned short kk;
|
||||
for (kk = 0; kk < 33000; kk++);
|
||||
}
|
Reference in New Issue
Block a user