#include<reg52.h> 
#define uint unsigned int 
#define uchar unsigned char
sbit pwm=P1^0;
uint cycle,high,low;
void delay(uint t)   //延时函数
{
	while(t--);	
}

void main (void)
{
	cycle=800;              
	while (1)        
	 {
	 	for(high=1;high<=cycle;high++)    //连续输出一串占空比不同的脉冲波形
		{ 
	   		pwm=1;        //输出高电平
	   		delay(high);     //高电平持续时间
	   		pwm=0;        //输出低平
			low=cycle-high;      
	  	    delay(low);      //低电平持续时间
	  	}
		high=1;
		delay(60000);
   	}	 
}