#include<reg51.h>
unsigned char cnt;
sbit pluse=P1^7;
void t0isr() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
cnt++;
if(cnt<10)pluse=1;
else if(cnt>=10 && cnt<30)pluse=0;
else cnt=0;
}
main()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
TR0=1;
ET0=1;
EA=1;
pluse=0;
while(1);
}
温馨提示:答案为网友推荐,仅供参考