Keil uvision 5 的花样流水灯
时间: 2023-12-10 14:35:26 浏览: 38
以下是使用Keil uVision 5实现的花样流水灯的代码和电路图:
```c
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit L1=P1^0;
sbit L2=P1^1;
sbit L3=P1^2;
sbit L4=P1^3;
sbit L5=P1^4;
sbit L6=P1^5;
sbit L7=P1^6;
sbit L8=P1^7;
void delay(uint xms)
{
uint i,j;
for(i=xms;i>0;i--)
for(j=110;j>0;j--);
}
void main()
{
while(1)
{
L1=0;delay(100);
L1=1;L2=0;delay(100);
L2=1;L3=0;delay(100);
L3=1;L4=0;delay(100);
L4=1;L5=0;delay(100);
L5=1;L6=0;delay(100);
L6=1;L7=0;delay(100);
L7=1;L8=0;delay(100);
L8=1;delay(100);
}
}
```
电路图如下:
![Keil uVision 5花样流水灯电路图](https://img-blog.csdn.net/20180419103212909?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY2hpbmFfY2hpbmFfY2hpbmFfY2hpbmFfY2hpbmFfY2hpbmFfY2hpbmFfY2hpbmFfY2hpbmFfY2hpbmFfY2hpbmFfY2hpbmFfY2hpbmFfY2hpbmFfY2hpbmFfYw==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/q/85)