I set the A2D in burst mode, turned it on and got it working by pulling the done bit. Now I’m trying to take it a step farther and use the A2D interrupt to get the conversion. However, I cannot seem to get it working. I have a book here I’m following pretty much verbatim and read the VIC and A2D parts of the datasheet. Cannot see what I’m missing. The code doesn’t vector to the IRQ.
If anybody can spot something / has any suggestions they would be greatly appreciated.
Thanks!
CODE~
#include "lpc246x.h"
//Globals
int sample = 0; // Declaired here so debugger has visibility
void A2Disr( void ) __irq
{
// Place latest sammple in memory
sample = AD0GDR;
// Clear A2D interrupt flag
// AD0STAT &= 0xFFFF7FFF;
// Write to signal end of IRQ
// VICVectAddr = 0x00000000;
}
int main( void )
{
// Configure ADC0.0 - Page 662
PCONP = 0x00001000; // Power on ADC - Page 60
APBDIV = 0x00000002; // Set Pclk to 30Mhrz
PCLKSEL1 = 0x00000000; // Set clock rate for ADC - Page 54
PINSEL1 = 0x00004000; // Connect AD0.0 to Port 0.23 - Page 175
PINMODE0 = 0x00000000; // Connect pull up resistors to Port0 - Page 183
AD0CR = 0x01210A01; // Configure ADC - Page 664
AD0INTEN = 0x80; // Turn on A2D interrupt for all A2D channels
VICVectAddr18 = (unsigned)A2Disr; // Set ISR Address
VICVectCntl18 = 0x00000024; // Set priority
VICIntEnable |= 0x00040000; // Turn connect A2D interrupt to VIC
while(1);
return 0;
}