Last active
April 16, 2018 17:37
-
-
Save PinLin/1eea336397a4b0e0b0fc615504f16133 to your computer and use it in GitHub Desktop.
是 89S51 ouoo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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++); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment