如下是我给客户写的参考代码,可在运行程序时不能连续中断,除非复位后再执行,想请教一下各位大虾帮我指点一下。
void main(void)
{ asm("FCLR I"); // Interrupt disable
prc0 = 1; // Protect off .configure main clock
cm13 = 1; // X-in X-out
cm15 = 1; // XCIN-XCOUT drive capacity select bit : HIGH
cm05 = 0; // X-in on
cm16 = 0; // Main clock = No division mode
cm17 = 0;
cm06 = 0; // CM16 and CM17 enable
asm("nop");
asm("nop");
asm("nop");
asm("nop");
ocd2 = 0; // Main clock change
prc0 = 0; //Protect on
pd3_3=0; //use for inputting as IRQ2(INT3 Interrupt input)
tcc00=0; //only when tcc00=0,can change tcc07,tcc06,tcc03,tcc04
tcc07=0;
tcc06=1;
tcc03=0;
tcc04=1; //cc04 tcc03=01 ,falling can interrupt
tcout3=1;
ssisel=0;
tcc10=1;
tcc11=1;
ilvl0_int3ic=1; //the highest interrupt level
ilvl1_int3ic=1;
ilvl2_int3ic=1;
ir_int3ic=0; //clear int3 interrupt
asm("FSET I"); //Interrupt disable
while(1)
{; }
}
void int3(void) //interrupt program
{ unsigned int count=2;
while(count>0)
{
count--; //在此设置询问是想监视ir_int3ic位是否自动清0
ir_int3ic=0;
}
}
如下是sect30.inc文件的部分内容
.lword dummy_int ; vector 25
.glb _int3 ; vector 26
.lword _int3
.lword dummy_int ; vector 27