Hey guys.I want to use the EXTI0 to light an LED but my code does not work.Im using LPC2138 that has simulation in proteus.
#include <LPC213x.h> /****************************************************************************** EINT0 interrupt service function ******************************************************************************/ __irq void EINT0_IRQHandler(void) { /* write code here */ IOSET0=1; EXTINT = (1UL<<0); /* Clear EINT0 interrupt flag */ VICVectAddr = 0; /* Acknowledge Interrupt */ } /* Default Interrupt Function: may be called when ISR is disabled */ __irq void DefISR (void) { } int main(void) { /* P0.0: PORT0.0 (General purpose I/O) Output P0.1: EINT0 (External interrupt 0 input) */ PINSEL0 = 0x0000000C; /* binary: 00000000_00000000_00000000_00001100 */ IO0DIR = 0x80000001; /* binary: 10000000_00000000_00000000_00000001 */ PINSEL1 = 0x00000000; /* binary: 00000000_00000000_00000000_00000000 */ PINSEL2 = 0x00000000; /* binary: 00000000_00000000_00000000_00000000 */ IO1DIR = 0x00000000; /* binary: 00000000_00000000_00000000_00000000 */ /****************************************************************************** External interrupts ******************************************************************************* Ext. interrupt 0 mode: Edge sensitivity / Falling edge / wake on interrupt 0 is Off */ EXTMODE = 0x01; /* binary: 00000001 */ EXTPOLAR = 0x00; /* binary: 00000000 */ INTWAKE = ( INTWAKE & 0xC00F ) | 0x0000; /* binary: 00000000_00000000 */ EXTINT = 0x01; /* clear the external interrupt flags */ /****************************************************************************** Vector interrupt initialization ******************************************************************************/ VICVectAddr0 = (unsigned long) EINT0_IRQHandler; /* set interrupt vector 0 */ VICVectCntl0 = ( 0x20 | 14 ); /* enable slot & use it for EINT0 Interrupt */ VICIntEnable |= (1UL<<14); /* Enable EINT0 Interrupt */ VICDefVectAddr = (unsigned long) DefISR; /* un-assigned VIC interrupts */ while(1) { } }
I have to mention that i use ARMWIZARD to produce the code.
No one can help me?
Neither ARMWizard and Proteus are Keil products.
Perhaps you might consult with your teachers, classmates or colleagues, or other local resources that are working on similar projects and software.
Review the Manuals for the products and chips you are using, instead of using a wizard to create things you don't understand out of thin air, you could review documentation and examples that already work with the tools you are using? Examples in Proteus?
Check YouTube for videos or tutorials.
Yeah your right about armwizard.It makes me a little lazy.But i know what it is doing.I just use this to save time. And i asked my teacher about it and he said that sometimes some version of proteus does not work properly. I programmed the code on hardware and it just worked.