#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uint count;
sbit pwm=P1^0;
/*void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}*/
void
time0_init()
{
TMOD=0x01;
TH0=0xfe;
TL0=0x33;
EA=1;
ET0=1;
TR0=1;
}
void main()
{
//count=0;
time0_init();
pwm=1;
while(1);
}
void timer0() interrupt 1
{
TH0=0xfe;
TL0=0x33;
count++;
if(count<5)
{
pwm=1;
}
else
{
pwm=0;
}
if(count==40)
{
count=0;
}
}
嗯·················
一周热门 更多>