keil5流水灯代码
时间: 2023-12-26 19:27:24 浏览: 300
02 心形流水灯仿真电路与程序_keil做桃心_keil5流水灯_keil心形流水灯_keil5_爱心灯仿真_
5星 · 资源好评率100%
以下是使用Keil编写的流水灯代码:
```c
#include <reg52.h>
#include <intrins.h>
#define led P2
typedef unsigned char u8;
typedef unsigned int u16;
void delay(u16 i) {
while(i--);
}
void main() {
u8 i;
led = 0xfe;
delay(50000);
while(1) {
for(i = 1; i < 8; i++) {
led = _crol_(led, 1);
delay(5000);
}
for(i = 1; i < 8; i++) {
led = _cror_(led, 1);
delay(5000);
}
}
}
```
阅读全文