[求助]这段程序中,正常运行时3个发光二极管led都不停闪烁,当有外部中断时(INT0=0),主程
序进入死循环,led0停止闪烁,而T1中断仍在继续,我在T1中断中设了个变量count1,当
count1 = 3时,想要跳转到主程序main开始处,这在汇编中只要一条LJMP语句就可以了,在
c中该怎样编呢?我很困惑。谁能告诉我?c程序如下
#include <reg51.h>
#include <intrins.h>
#include <absacc.h>
int count1,count0;
sbit P10 = P1^0;
sbit P11 = P1^1;
sbit P12 = P1^2;
void delay()
{
int i=50;
while(i--) _nop_();
}
void main()
{
TMOD = 0x11; //方式1,16位
ET0 =1;
ET1 = 1;
EX0 =1;
PT1 = 1;
EA = 1;
TR0 = 1;
TR1 = 1;
while(1)
{ P10 = !P10; //正常运行时P10闪烁
count1=0;
delay();
if(INT0 ==0) while(1);/*如有外部中断,则掉入死循环*/
}
}
void T0_srv()interrupt 1 using 1
{
P11 = !P11;
count0++;
}
void T1_srv()interrupt 3 //定时器T1其实是起软件复位的作用
{
P12 = !P12;
count1++;
if(count1 ==3) ? /*??到3时,该怎样回到主程序? */
}
void int0_srv()interrupt 0
{
INT0=0;
}