timothy2008 发表于 2010-10-26 22:51:29

LPC2368 中斷

小弟經過多次調試,還是無法實現中斷
中斷是低電平觸發 EINT1 P2.11
當P2.11 接地的時候 程序在LPC2300.S 跑
開發程式是UVISION4 用JLINKV8調試
以下是其中一段程序

LPC2300.S

; Exception Vectors
;Mapped to Address 0.
;Absolute addressing mode must be used.
;Dummy Handlers are implemented as infinite loops which can be modified.

Vectors         LDR   PC, Reset_Addr         
                LDR   PC, Undef_Addr
                LDR   PC, SWI_Addr
                LDR   PC, PAbt_Addr
                LDR   PC, DAbt_Addr
                NOP                            ; Reserved Vector
            ; LDR   PC, IRQ_Addr
                LDR   PC,    ; Vector from VicVectAddr
                LDR   PC, FIQ_Addr            

Reset_Addr      DCD   Reset_Handler
Undef_Addr      DCD   Undef_Handler
SWI_Addr      DCD   SWI_Handler
PAbt_Addr       DCD   PAbt_Handler
DAbt_Addr       DCD   DAbt_Handler
                DCD   0                      ; Reserved Address
IRQ_Addr      DCD   IRQ_Handler
FIQ_Addr      DCD   FIQ_Handler            當中斷發生後,不停的重復執行這句

Undef_Handler   B       Undef_Handler
SWI_Handler   B       SWI_Handler
PAbt_Handler    B       PAbt_Handler
DAbt_Handler    B       DAbt_Handler
IRQ_Handler   B       IRQ_Handler
FIQ_Handler   B       FIQ_Handler


; Reset Handler

                EXPORTReset_Handler
Reset_Handler   


主程序

void clkinit(void)
{
PLLCON=0;/* disconnect and disable*/
PLLFEED=0xAA;/*PLL FEED*/
PLLFEED=0x55;
CLKSRCSEL=0x01;/*ETC source 12Mhz*/
PLLCFG=((0x0<<16)|(0x0B));/*N=1 M=12 FCC0=288Mhz*/
PLLFEED=0xAA;/*PLL FEED*/
PLLFEED=0x55;
PLLCON=0x01;/* disconnect and ENable*/
PLLFEED=0xAA;/*PLL FEED*/
PLLFEED=0x55;
CCLKCFG=0x02;/*divide by 24CCLK=96Mhz*/
while((PLLSTAT & 0x4000000)==0);/* wait until PLOCK = 1 */
PLLCON=0x03;/* disconnect and ENable*/
PLLFEED=0xAA;/*PLL FEED*/
PLLFEED=0x55;

PCLKSEL1=((0x01<<28)|(0x01<<4)|(0x01<<2));/*GPIO,CONNECT BLOCK,CONTROL BLOCK F=CCLK */
}

void intinit (void)
{
FIO2DIR=((1<<1)|(1<<0));
FIO2CLR=0x03;
FIO2SET=0x03;
PINSEL4=(1<<22);/*Block connect EINT1*/
VICVectPriority0 = 0;
VICVectAddr0 = (unsigned)test;
VICIntSelect=(1<<15);
VICIntEnable=(1<<15);
__enable_irq();
}

void test (void) __irq
{
FIO2CLR = 0x03;
pant(0x1f);
EXTINT = 0x02;
VICVectAddr = 0x00000000;
}

int main (void)
{
                       
clkinit();
intinit();

IODIR0=0XFFFFFFFF;
IOCLR0=0XFFFFFFFF;

while(1);

}

timothy2008 发表于 2010-10-27 15:32:25

問題己解決,因為EINT1一定要用VICVectAddr15 和 ICVectPriority15

在途中 发表于 2013-10-24 14:14:42

问LZ个问题,这里干嘛要先清零再写一?
FIO2CLR=0x03;
FIO2SET=0x03;
页: [1]
查看完整版本: LPC2368 中斷