hello,
I am usinf msp430f5659 and trying to interface adc on pin p6.2. I have intialized adc but it is not converting anlog voltage. I have maximum voltage of 3.3 on p6.2. I have 4MHz smclk. It is not entering into ISR. Please help me to find the problem.
My code is:
void adc_configure()
{
P6SEL |= BIT2; // selecting bit0 as analog input pin
ADC12CTL0 &= ~ ADC12ENC;
REFCTL0 &= ~REFMSTR; // Reset REFMSTR to hand over control to
// ADC12_A ref control registers
ADC12CTL0 |= ADC12ON + ADC12SHT0_12 + ADC12MSC + ADC12REFON + ADC12REF2_5V; // To on ADC10,Reference on, 1024 ADC12CLK cycles
ADC12CTL1 |= ADC12DIV_7 + ADC12SSEL_3; // ADC12SC sample and hold source, Stright binary format, /8 clock divider, clk source= SMCLK, Single channel signal conversion, no operation is active
ADC12CTL2 |= ADC12RES_1 + ADC12PDIV; //ADC12_A resolution 10 bit (11 clock cycle conversion time), ADC12_A predivider/4
ADC12MCTL0 = ADC12SREF_1 + ADC12INCH_2; //selected ref = vcc and vss, selected channel= A2
ADC12IE |= ADC12IE0 ; // ADC_IFG upon conv result-ADCMEMO
ADC12CTL0 |= ADC12ENC; // To start sample and conversion, to enable ADC12
__bis_SR_register(GIE);
}
#pragma vector= ADC12_VECTOR
__interrupt void ADC12_ISR(void)
{
while (!(ADC12IFG & BIT0));
__bic_SR_register_on_exit(CPUOFF);
}
this is in my main function :
ADC12CTL0 |= ADC12SC + ADC12ENC ; // To start sample and conversion, to enable ADC10
adc12_value = (float)ADC12MEM0;
sprintf(string,"%3.2f",adc12_value);