我今天又写了一个检察我中断的小程序,果然发现烧入到单片机内的中断不响应,发光二极管不闪,而在仿真器里什么问题也没有,我把我写的程序贴出来看看,麻烦哪位高手指点迷津 #include "reg51.h" sbit P10=P1^0; unsigned char t0fg=0; unsigned int n;
main() { TMOD = 0x20; TCON =TCON|0x40; ES =1; ET0 = 1; TMOD = TMOD |1; TCON=TCON|0x10; EA=1;
while(1) { if (t0fg==1) { P10=0; for(n=0;n<20000;n++); P10=1; for(n=0;n<20000;n++); } } } //定时器中断 void t0_int() interrupt 1 { t0fg=1; }
|