#include
#include
#define uchar unsigned char
uchar pwm,ctl=5;
sbit fmq=P1^0;
bit flag;
void delay(uchar a)
{
uchar i;
while(a--)for(i=0;i<120;i++);
}
void t0isr() interrupt 1
{
pwm++;
if(pwm<=ctl)P0=0xff;
else P0=0x00;
if(pwm==100)
{
pwm=0;
ctl++;
}
if(ctl==100)flag=1;
}
main()
{
uchar i,led;
TMOD=0x02;
TH0=236;
TL0=236;
ET0=1;
EA=1;
while(1)
{
led=0xfe;
for(i=0;i<8;i++)
{
P0=led;
led=led<<1;
delay(200);
}
led=0xff;
delay(200);
led=0x7f;
for(i=0;i<8;i++)
{
P0=led;
led=led>>1;
delay(200);
}
TR0=1;
flag=1;
while(flag);
TR0=0;
}
}