Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 62309

Forum Post: RE: REFCTL0 reg on Msp430f5438a

$
0
0
I have a MSP430F5341 with 1.500V (verified) connected to the analog input A3, the internal 2.5V reference selected and am attempting to see A/D conversion results of 2457 counts. (2457 / 4096 * 2.5 = 1.5V) Here are the two code versions I have tried: Version 1: P6SEL |= BIT3; // Enable A/D channel A3 REFCTL0 = REFVSEL_3 + REFON; // 2.5V ref active ADC12CTL0 = ADC12ON + ADC12SHT0_2; // Turn on ADC12, Sampling time ADC12CTL1 = ADC12SHP; // Use sampling timer ADC12MCTL0 = ADC12SREF_1; // Vr+ = internal 2.5V Vr- = VSS for ( i=0; i < 0x30; i++); // Delay for reference start-up ADC12CTL0 |= ADC12ENC; // Enable conversions Version 2: P6SEL |= BIT3; // Enable A/D channel A3 REFCTL0 &= ~REFMSTR; // Reset REFMSTR to hand over control to ADC12_A ref control registers ADC12CTL0 = ADC12ON + ADC12SHT0_2 + ADC12REFON + ADC12REF2_5V; // Turn on ADC12, Sampling time ADC12CTL1 = ADC12SHP; // Use sampling timer ADC12MCTL0 = ADC12SREF_1; // Vr+ = internal 2.5V Vr- = VSS for ( i=0; i<0x30; i++); // Delay for reference start-up ADC12CTL0 |= ADC12ENC; // Enable conversions This code returns the A/D counts: ADC12MCTL0 = ADC12SREF_1 + ADC12INCH_3; // select input channel 3 - test voltage to be measured ADC12IFG=0;//clear all flags ADC12CTL0 |= ADC12SC; // Start conversion while (ADC12IFG==0); //while no conversions are complete on any A/D channel... lcounts = ADC12MEM0; Both versions return counts that bounce all around 2457 (low of 1857 to high of 3093). Power supply is a quiet 3V battery source. 1.5V test voltage is quiet with only about 30-40mV of noise p-p. I'd really like to see this work with both references so I can evaluate which is best for my product. Any help is greatly appreciated.

Viewing all articles
Browse latest Browse all 62309

Trending Articles



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