帮我解释一下这个流水灯程序~程序运行结果是8个灯间歇性亮灭,就是先全亮,然后慢慢变暗,再亮,再慢慢变#include #define uint unsigned int void delay1(uint t);void jianliang();void main (void){while (1) {jianliang();
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 09:49:14
帮我解释一下这个流水灯程序~程序运行结果是8个灯间歇性亮灭,就是先全亮,然后慢慢变暗,再亮,再慢慢变#include #define uint unsigned int void delay1(uint t);void jianliang();void main (void){while (1) {jianliang();
帮我解释一下这个流水灯程序~程序运行结果是8个灯间歇性亮灭,就是先全亮,然后慢慢变暗,再亮,再慢慢变
#include
#define uint unsigned int
void delay1(uint t);
void jianliang();
void main (void)
{
while (1)
{
jianliang();
}
}
void delay1(uint t)
{
while(--t);
}
void jianliang()
{
unsigned int CYCLE=600,PWM_LOW=0;
P2=0xff;
for(PWM_LOW=1; PWM_LOW0;PWM_LOW--)
{
P2=0x00;
delay1(CYCLE-PWM_LOW);
P2=0xff;
delay1(PWM_LOW);
}
P2=0xff;
}
帮我解释一下这个流水灯程序~程序运行结果是8个灯间歇性亮灭,就是先全亮,然后慢慢变暗,再亮,再慢慢变#include #define uint unsigned int void delay1(uint t);void jianliang();void main (void){while (1) {jianliang();
利用对亮和灭延迟时间的不同,加上视觉暂留就有逐渐变化的效果
for(PWM_LOW=1; PWM_LOW