Other Parts Discussed in Thread: MSP430G2553
I am trying to take an ADC reading on 4 of the analog pins on an MSP430G2553. I want to take a single reading using Vcc as my reference voltage. I am trying to take these readings on P1.0, P1.3, P1.4, and P1.5. The issue I am having is that the readings on P1.3, P1.4, and P1.5 seem to be reading in correctly while the reading from P1.0 never moves. It doesn't matter how much I change the voltage on the pin it just never changes. I think this is an issue in my setup but this is my first adc project and I am unsure. I have included my code. Any help would be greatly appreciated.
#include <msp430.h>
volatile unsigned int adc_read[10];
void main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
BCSCTL1 = CALBC1_12MHZ;
DCOCTL = CALDCO_12MHZ;
BCSCTL2 |= DIVS_0; // SMCLK = MCLK = 12Mhz
BCSCTL3 |= LFXT1S_2; // LFXT1 = VLO
ConfigureADC();
while(1){
ADC_Read();
volatile unsigned int pin_one_zero = adc_read[3];
volatile unsigned int pin_one_three = adc_read[2];
volatile unsigned int pin_one_four = adc_read[1];
volatile unsigned int pin_one_five = adc_read[0];
_nop();
} //while(1)
} //main()
// ADC10 interrupt service routine
#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR (void)
{
__bic_SR_register_on_exit(CPUOFF); // Return to active mode
}
void ConfigureADC(void) {
/* Configure ADC Channel */
P1SEL |= BIT0 + BIT3 + BIT4 + BIT5;
ADC10CTL1 = INCH_5 + ADC10DIV_3 + CONSEQ_1 + SHS_0; // Channel 5, ADC10CLK/4
ADC10CTL0 = SREF_0 + ADC10SHT_3 + MSC + ADC10ON + ADC10IE; //Vcc & Vss as reference
ADC10DTC1 = 4;
ADC10AE0 = BIT0 + BIT3 + BIT4 + BIT5; //P1.5 ADC option
} //void ConfigureADC(void)
void ADC_Read(void) {
delay_ms(20); // Wait for ADC Ref to settle
ADC10CTL0 &= ~ENC;
while (ADC10CTL1 & BUSY);
ADC10SA = (unsigned int)adc_read;
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
__bis_SR_register(CPUOFF + GIE); // LPM0 with interrupts enabled
_nop();
} //void ADC_Read(void)