#include“reg52.h” //头文件,包含各种寄存器定义及函数库
unsigned char pwm;
time0() interrupt 1 using 0
{
TH0=0xfe;TLO=0x0c; if(pwm==10){pwm=0;} if(pwm<1) {P1_0=1;}
else{P1_0=0;}
P1_0=~P1_0;
}
main()
{
TMOD=0x01; TH0=0x3C;TLO=0xB0;
//12MHz下,50ms定时所对应的初值
EA=1;ET0=1;TRO=1;
while(1)
{
}
}