Error reading the ADC
2005-06-10 by soren_t_hansen
I have set up the ADC to run in hardware mode, and is sampling at a rate of 60 Khz over 4 channels. I use the Keil MCB2130 eval. board, which means, that I have a Potmeter connected to my AIN0. But when I read my channel 0 in the interrupt method, I keep getting 0 nomatter what. I have the following setup for my ADC: AD0CR = 0x0023180F; //AIN0-3, 9 bits @ 60 kHz (=15 Khz pr. channel) VICVectCntl0 = 0x00000032; VICVectAddr0 = (unsigned long)AD_ISR; VICIntEnable |= 0x00040000; In my interrupt handler I do the following: unsigned int val, chan; val = AD0DR; /* Read A/D Data Register */ val = (val >> 6) & 0x03FF; //9 bits - if 10 bits use 0x03FF chan = ((AD0DR >> 0x18) & 0x07); result[chan] = val; //Result is a unsigned int array of size 4 VICVectAddr = 0; //Reset interrupt I then write the result[0] variable to the serial port to see what the result[0] is and always gets 0. Has it something to do with my setup of the ADC? Best Regards Søren Hansen