3、程序02跑马灯。程序返氏03并驾齐驱跑马灯。
cmyk:闹埋红(漏弯厅c:0m:100y:100k:0)橙(c:0m:35y:100k:0)黄(c:0m:0y:100k:0)绿(c:100m:0y:100k:0)青(c:100m:50y:0k:0)蓝(c:100m:100y:0k:0)紫(c:45m:100y:0k:0)RGB:红(R:255G:0B:0)橙返隐(R:255G:156B:0#include<reg51.h>sbit LED0=P0^0
sbit wei=P1^1
sbit duan=P1^0
sbit lcden=P1^7
sbit dianzhen=P1^3
sbit leden=P1^2
void Delay(unsigned int t)
void main (void)
{
unsigned int CYCLE=600,PWM_LOW=0//定义周腔烂衫期并赋历袜值
lcden=0
P0=0x00
dianzhen=0
P0=0xff
wei=0
duan=0
while (1) //主循环
{
LED0=1
Delay(150000)//特意加伍腔延时,可以看到熄灭的过程
for(PWM_LOW=1PWM_LOW<CYCLEPWM_LOW++)
{
LED0=0
Delay(PWM_LOW)
LED0=1
Delay(CYCLE-PWM_LOW)
}
for(PWM_LOW=CYCLE-1PWM_LOW>0PWM_LOW--)
{
LED0=0
Delay(PWM_LOW)
LED0=1
Delay(CYCLE-PWM_LOW)
}
}
}
void Delay(unsigned int t)
{
while(t--)
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)