I am dealing with ADC module. Just at initial stage of testing. Since my board msp-expF5529 has its on board POT of 10Kohm, I am intended to use that as my analog voltage generator, no matter what I tried, how many times I tried, but unsuccessful. An alternative was, I applied a fixed DC voltage(less than Vref) to pin 6.7(A7) on my board and write the code for the same. I am attaching a copy of my code with(modified version of code from msp430ware, code for adc sampling with internal reference). Please help me out. OR
Let me know What an ADC module takes to initiate and work, give me some directives for the same.
"
#include <msp430.h>
int main(void)
{
volatile unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
// P6DIR |= 0x00;
P6SEL |= BIT7; // Enable A/D channel A0
REFCTL0 &= ~REFMSTR; // Reset REFMSTR to hand over control to
// ADC12_A ref control registers
ADC12CTL0 = ADC12ON+ADC12SHT02+ADC12REFON+ADC12REF2_5V;
// Turn on ADC12, Sampling time
// On Reference Generator and set to
// 2.5V
ADC12CTL1 = ADC12SHP; // Use sampling timer
ADC12MCTL7 = ADC12SREF_1; // Vr+=Vref+ and Vr-=AVss
ADC12MCTL7 = ADC12INCH_7;
for ( i=0; i<0x30; i++); // Delay for reference start-up
ADC12CTL0 |= ADC12ENC; // Enable conversions
while (1)
{
ADC12CTL0 |= ADC12SC; // Start conversion
while (!(ADC12IFG & BIT7));
__no_operation(); // SET BREAKPOINT HERE
}
}
"