This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

A-pool ADC

Thank you to anyone who can help

I am having trouble reading in an analog voltage.  The analog voltage is a DC voltage that I can vary between 0-250 mV and it has a positive lead attached to pin 12 and ground attached to microprocessor ground.  I find that the Result variable counts up every time I run through the code until it saturates at 256 and goes back to 0 and starts again.  I am also watching APINT and it seems to be constant at 0x01B0 no matter what i do.  Any Suggestions?  

I also have an understanding question.  In the code (adopted from TI's toolbox (ADC1)):
 APCTL = OSEL+CBSTP+RUNSTOP+APPSEL_5+APNSEL_0;

I understand here that APNSEL_0 assigns A0 to the comparator, but why do they assign APPSEL_5 to the comparator.  Shouldn't we only need one pin to do an A/D conversion

Thanks again and sorry for the beginner type questions.

The code I am using is:

#include <msp430.h>

int Result;

int main(void)
{

WDTCTL = WDTPW + WDTHOLD; // Stop WDT 

// Begin Configuration of the A-POOL registers

APCTL = 0; // Clear APCTL register
APIE = EOCIE; // Enable Interrupt for End of Conversion 
APCNF = CMPON+DBON+CONVON+APREFON+EOCBU+CLKSEL_MCLK; // Configure A-POOL elements, Select MCLK as A-POOL Clock Source
APINT = 0x00; // Clear ADC-DAC-REG
APCTL = OSEL+CBSTP+RUNSTOP+APPSEL_5+APNSEL_0; // Set Channels and Start Conversion
if (Result > 150)
P1OUT &= ~0x01; // High Analog input results in digital ON
else
P1OUT |= 0x01;
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupts enabled
}

//A_POOL Interrupt Service Routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=APOOL_VECTOR
__interrupt void A_POOL(void)

{

Result = APINT; //Place Breakpoint Here - Move the converted value to Result variable
}

#elif defined(__GNUC__)
void __attribute__ ((interrupt(APOOL_VECTOR))) A_POOL (void)
#else
#error Compiler not supported!
#endif

**Attention** This is a public forum