hai i am doing basic programs in lpc2138 ARM controller problem is exter nal interrupt is only once generates but again it is not generate.send me what is the problem.this is my code
//*****************************************************
#include<lpc213x.h> #include <stdio.h>
extern void init_serial(void); unsigned char temp; void EXTINTVectoredIRQ (void)__irq;
void EXTINTVectoredIRQ (void)__irq { unsigned int temp; IOCLR1=0XFFFFFFFF; EXTINT=0X00000020; temp = VICIRQStatus; printf("isr_temp=%x\n",temp); VICVectAddr15=0; }
int main() { init_serial(); //printf("temp\n"); IODIR1=0X00FF0000; IODIR0=0X20000000; PINSEL1=0X00000000; PINSEL0=0X200000C5; //interrupt pin p0.14 EXTMODE = 0; // LEVEL sensitive mode on EINT1 EXTPOLAR = 0; VICDefVectAddr = 0x0000002f; VICIntSelect |=0x00000000; VICVectAddr15 |=(unsigned int)EXTINTVectoredIRQ; VICVectCntl15 |= 0x0000002f; VICIntEnable |=0x00008000; PINSEL0=0X20000005; temp = VICIRQStatus; printf("temp=%x\n",temp); while(1) { IO1CLR =0X00FF0000; IOSET1 =0x00FF0000;
} }
//*******************************************
Not sure if you did any changes to the code besides removing the ****************.
But does the code seems correctly posted this time? Where are the indenting? Did you really, really read the posting instructions - I even told you exactly where to read.
Your code should look like:
#include <stdio.h> int main(void) { printf("Hello World!\n"); return 0; }
Why is it so hard to post your code as:
Do you think it will be too easy to read then?
And by the way - you still like to use printf() in your interrupt handler. Have you spent any time pondering the execution time of printf() yet? Have you considered the amount of stack space you need to allocate for your interrupt handlers, since they have a separate stack from the mail code?
And have you tried my suggestion about what register to write to when acknowledging the interrupt?
Hello Per Westermark
i removed printf statement then also it generate only once a interrupt.VICVectAddr15=0x0000002f;I had passed vector address like this. #include<lpc213x.h> #include <stdio.h> extern void init_serial(void); unsigned char temp; void EXTINTVectoredIRQ (void)__irq; unsigned int x=0;
void EXTINTVectoredIRQ (void)__irq {
x++; x=x<<16; IO1SET=x; EXTINT=0X00000020; VICVectAddr15=0x0000002f;
}
int main() {
IODIR1=0X00FF0000; IODIR0=0X20000000; PINSEL1=0X00000000; PINSEL0=0X200000C5; //interrupt pin p0.14 EXTMODE = 0; // LEVEL sensitive mode on EINT1 EXTPOLAR = 0; VICDefVectAddr = 0x0000002f; VICIntSelect |=0x00000000; VICVectAddr15 |=(unsigned int)EXTINTVectoredIRQ; VICVectCntl15 |= 0x0000002f; VICIntEnable |=0x00008000; while(1) {
IO1CLR =0X000000ff; IOSET1 =0x000000ff;
Do you really think that formatting is correct and easy to read?
Look - the instructions really are very clearly stated: www.danlhenry.com/.../keil_code.png
If you can miss details as obvious as that, you probably need to re-read the lpc2138 for any important details that you've missed there!
But one thing the instructions don't mention: use only spaces to lay out your code - do not use TABs!