从P1.0上输出一个方波,高电平5ms,低电平10ms.
#include〈reg51。h〉
unsigned char flag;
sbit out=P1^0;
void main()
{
flag=0;
TMOD=0X02;
TH0=6;
TL0=6;
TR0=1;
EA=1;
ET0=1;
while(1);
}
void int0_0() interrupt 1
{
flag++;
if(flag==40) out=1;
else if(flag==60)
{flag=0;out=0;}
}