Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

MSP430F5419A ADC12 reading in MEM not stable

$
0
0

Hi,

I'm reading the ADC12 value at MEM2 but the value is not stable. Anyone can help me or which code is more suitable? I measure the input voltage for the A2 is very stable.

What is the main reason causing unstable value? It varies from 0x0092 to 0x00ED. It is very hard to determine the value of the ADC.

Below is my code modified from sample code. I'm using internal reference 2.5V

#include "msp430x54xA.h"

void main(void)
{
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer

P6SEL = BIT2; // Enable A/D channel A0

/* Initialize REF module */
// Enable 2.5V shared reference, disable temperature sensor to save power
REFCTL0 |= REFMSTR+REFVSEL_2+REFON+REFTCOFF;

/* Initialize ADC12 */
ADC12CTL0 = ADC12ON+ADC12SHT02; // Turn on ADC12, set sampling time
ADC12CTL1 = ADC12SHP+ADC12CSTARTADD_2; // Use sampling timer
ADC12MCTL2 = ADC12SREF_1 + ADC12INCH_2; // Vr+=Vref+ and Vr-=AVss

__delay_cycles(75); // 75 us delay @ ~1MHz

ADC12CTL0 |= ADC12ENC; // Enable conversions

while (1)
{
ADC12CTL0 |= ADC12SC; // Start conversion
while ((!(ADC12IFG & BIT2)) ;
__no_operation(); // SET BREAKPOINT HERE
}
}

Thanks


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>