//中断函数里面需要重新转载一下定时器初值吧,不然就会。。。。不是用的自动重装模式的void zd() interrupt 1{ TH0 = 0xD2; TL0 = 0xD2; if(i>=400) i=0; if(i<30) pwm = 1; else pwm = 0; i++;}