Hello all, i am using lpc2148 in one of my application. i used adc conversion competition interrupt, so that no need to poll it. It works fine when first time it completes conversion of adc and execute ISR, but interrupt flag (ADINT) not get clears even i read all registers (ADDR,ADGDR,ADSTAT), so next time when adc conversion get complete, it does not jump to ISR.
Please help....
For clearing interrupt you huave to put isr like.....
unsigned int status,A0_1; void ADC_Init() //This function inits ADC peripheral { VICIntEnable=0x0; PINSEL1|= (1<<24); AD0CR=(1<<1)|(13<<8)|(1<<21); AD0INTEN=(0x00)|(1<<1); status0=AD0STAT; VICVectAddr9=(unsigned long) ADC0_ISR0; VICVectCntl9=0x20|18; VICIntEnable=(VICIntEnable) |(1<<18); } void __irq ADC0_ISR0(void) { int ad; status0=AD0STAT; ad=status0 & 0x000000FF; switch(ad) {case 0x02: A0_1 = AD0DR1 ; //Store converted data A0_1= AD0DR1 ;// again read and clear interrupt break; default : break; } if(ad==0x02) A0_1 = (A0_1 >>6); //result-------every time you need to read it it is updated every time so use it to display on lcd Delay(1); VICVectAddr = 0; // Acknowledge Interrupt } void main() { //your variables and other codes while(1) { Delay(10); AD0CR = (AD0CR&0xFFFFFF00)|(1<<1)|(1<<24); Delay(10); } }
Thank you very much for your reply. I am really thankful to all of you. I will surely check for the code you have provided and will come to know you about it as soon as possible.
you can also debug this code and find out you can easily got your ways to come forward...
View all questions in Keil forum