pwm程序一起讨论讨论
时间:10-02
整理:3721RD
点击:
#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit LED0=P1^0;
void delayms(uint t)
{
while(--t);
}
void main()
{
uint CYCLE=600,PWM_LOW=0;
while(1)
{
LED0=1;
delayms(60000);
for(PWM_LOW=1;PWM_LOW<CYCLE;PWM_LOW++)
{
LED0=0;
delayms(PWM_LOW);
LED0=1;
delayms(CYCLE-PWM_LOW);
}
LED0=0;
for(PWM_LOW=CYCLE-1;PWM_LOW>0;PWM_LOW--)
{
LED0=0;
delayms(PWM_LOW);
LED0=1;
delayms(CYCLE-PWM_LOW);
}
}
}
#define uchar unsigned char
#define uint unsigned int
sbit LED0=P1^0;
void delayms(uint t)
{
while(--t);
}
void main()
{
uint CYCLE=600,PWM_LOW=0;
while(1)
{
LED0=1;
delayms(60000);
for(PWM_LOW=1;PWM_LOW<CYCLE;PWM_LOW++)
{
LED0=0;
delayms(PWM_LOW);
LED0=1;
delayms(CYCLE-PWM_LOW);
}
LED0=0;
for(PWM_LOW=CYCLE-1;PWM_LOW>0;PWM_LOW--)
{
LED0=0;
delayms(PWM_LOW);
LED0=1;
delayms(CYCLE-PWM_LOW);
}
}
}
what do u want to say ?
小编是分享下呢还是?
你好。有些问题。能帮我解答一下么