第一个发光管以间隔200ms闪烁
```c
include sbit D1 = P1^0; int a; void main(){ while(1){ D1=0; a=25000; while(--a); D1=1; a=25000; while(--a); } } ``` ```c include include define uint unsigned int define uchar unsigned char void delay(uint); uchar temp; sbit beep = P2^3; void main(){ temp = 0xfe; while(1){ P1 = temp; beep = 0; delay(500); P1 = 0xff; beep = 1; delay(500); temp = _crol_(temp,1); } } void delay(uint z){ uint x,y; } ``` ```c include sbit D1 = P1^0; int a; void main(){ while(1){ for(a=0; a<8; a++){ D1 = 0; delay(100); D1 = 1; delay(100); } } } ``` ```c include sbit D1 = P1^0; int a; void main(){ while(1){ for(a=0; a<8; a++){ P1 = (1 << a); delay(100); } for(a=7; a>=0; a--){ P1 = (1 << a); delay(100); } } } ``` ```c include sbit D1 = P1^0; int a; void main(){ while(1){ for(a=0; a<8; a++){ P1 = (1 << a); delay(100); } for(a=7; a>=0; a--){ P1 = (1 << a); delay(100); } delay(300); for(a=0; a<8; a++){ P1 = (1 << a); delay(100); } for(a=7; a>=0; a--){ P1 = (1 << a); delay(100); } delay(300); for(a=0; a<8; a++){ P1 = (1 << a); delay(100); } for(a=7; a>=0; a--){ P1 = (1 << a); delay(100); } } } ```8个发光管由上至下间隔1s流动,每个管亮500ms,灭500ms,亮时蜂鸣器响,灭时关闭蜂鸣器
8个发光管来回流动,每个管亮100ms
用8个发光管演示8位二进制数累加过程
8个发光管间隔200ms由上至下,再由下至上,再重复一次,然后全部熄灭再以300ms间隔全部闪烁5次
间隔300ms第一次一个管亮流动一次,第二次两个管亮流动,依次到8个管亮,然后重复整个过程