#include<msp430.h>
#include<stdio.h>
int adc_out;
int main(void)
{
WDTCTL = WDTPW+WDTHOLD;
P6SEL |=BIT1;
REFCTL0 &=~REFMSTR;
ADC12CTL0 |=ADC12ON|ADC12SHT02|ADC12REFON|ADC12REF2_5V; //1.ADC ON
ADC12CTL1 |=ADC12SHP;
ADC12MCTL1 |=ADC12INCH_1 |ADC12SREF_1;
/
//ADC12MCTL1 |=ADC12SREF_1;
ADC12CTL0 |= ADC12ENC;
while(1)
{
ADC12CTL0 |=ADC12SC; // start conversion
while(!(ADC12IFG & BIT1));
adc_out =ADC12MEM1;
printf("adc_out = %d\n",adc_out);
}
return 0;
}
hello
i am using following code for reading the data of analog channel A1,
this code is not working properly, i am not getting conversion result in the ADC12MEM1.
need help ASAP.