Halo to everyone,
I have ARM NXP LPC2378 on MCB2300 board, and when I upload blinky example project to board AD converter works correct, but when I write my code, and upload to board, my program never gets into ADInterrupt routine? Does anyone, know what is problem? u
here is my code
#include <LPC23xx.H> short AD_last; __irq void ADC_IRQHandler(void) { AD_last = (AD0DR0 >> 6) & 0x3FF; /* Read Conversion Result */ VICVectAddr = 0; /* Acknowledge Interrupt */ } int main(void) { /* Power enable, Setup pin, enable and setup AD converter interrupt */ PCONP |= (1 << 12); /* Enable power to AD block */ PINSEL1 = 0x4000; /* AD0.0 pin function select */ AD0INTEN = (1 << 0); /* CH0 enable interrupt */ AD0CR = 0x01200301; /* Power up, PCLK/4, sel AD0.0 */ VICVectAddr18 = (unsigned long)ADC_IRQHandler;/* Set Interrupt Vector */ VICVectCntl18 = 14; /* use it for ADC Interrupt */ VICIntEnable = (1 << 18); /* Enable ADC Interrupt*/ while(1) {} }
Thank you, Bojana
Check whether you have enabled IRQ interrupts. You need to do this as well as enabling the interrupt in the VIC.
Hope this helps.
Chris
I had enabled IRQ too, with debug mode I realized that AD Interrupt routine is always executed ones, and now at the end of that routine I start AD conversion again with AD0CR|=0x01000000;, and it works.I only don't understand way example code works without that and mine don't.
Thank you Chris for help