void init_timer0(void)
{
INTCON = 0x01; //vector IRQ mode,IRQ enable,FIQ reserved
INTMOD = 0x00000000; //all interrupt IRQ mode
INTMSK = ~TIMER0_MSK; //mask all except timer0
I_PSLV = 0x1b1b1b1b; //timer0 1st priority of mGC others initial
I_PMST = 0x011163; //operating mode=fix mode mGC=1st priority
_ISR_TIMER0 = (unsigned)timer0_interrupt;
TCFG0 = TCFG0_val;
TCFG1 = TCFG1_val;
TCNTB0 = TCNTB0_val;
TCMPB0 = TCMPB0_val;
TCON = 0x6;
TCON = 0x19;
}
void __irq timer0_interrupt(void)
{
I_ISPC = 0xffffffff; //clear all intrrupt pending
light_black = !light_black;
}
主要代码如上啊,就是进不了中断 |