Other Parts Discussed in Thread: MSP430G2553, MSP430WARE
The code given below gives the reading of ADC10MEM at static level only and doesn't give the reading if the input is changes. I want it to be changed at every level i change the input. I am using potentiometer shows the output of particular level if I change the voltage then i have re run the code. Can anybody help.
#include "msp430g2553.h"
#include "intrinsics.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // stop WDT
// ADC configuration,V+ref=3V,V-ref=0V,Channel=A0
ADC10CTL0 = ADC10ON + ADC10IE; // Vref Vr+=3v,Vr-=VSS,
// S&Htime = 4 X ADCCLK,ADC10 on,ADC interrupts enabled
ADC10CTL1 = ADC10DIV_7; // INCH =0000->A0,ADCCLK src = ADC10CLK,
// ADCCLK/8,Single Channel Single Conversion
ADC10AE0 = INCH_0; // channel A0
ADC10CTL0 |= ENC + ADC10SC; // Start Conversion
_BIS_SR(LPM0_bits +GIE); // Go to LPM0,interrupts enabled
}
/***************************************************************************/
/* interrupt vectors for MSP430 */
/***************************************************************************/
#pragma vector = ADC10_VECTOR
__interrupt void adc10_interrupt(void)
{
ADC10CTL0 |= ENC + ADC10SC; // Start Conversion again
}