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

About MSP430F4152 AD

$
0
0

Hi:

   I use MSP430F4152 AD to sample voltage.Here is my schematic:

    ___  Voltage(5 V)

      ||  1M Res

      |-------------> To ADC

      ||  1M Res

   GND

The ADC's Ref Voltage is 3.3V. But the AD Cvt value is about 501. In my mind, the ADC Value should be about 5V / 2 / 3.3V * 1023 = 775. But why ADC value is only 500?

Here is my ADC Code:

//Disable ADC First    

 ADC10CTL0  &=   ~ENC;

//Set/Update ADC Ctrl Reg:     //Vcc <-> Vss as Vref

ADC10CTL1   =   INCH_1;

 ADC10CTL0   =   ADC10SHT_2 + ADC10ON;

//Enable A1 Channel which is Pwr Monitor Channel    

ADC10AE0    =   BIT1;   //Eanble ADC-Channel 1(A1) Input    

//Enable ADC

 ADC10CTL0   |= ADC10ON;     //Open ADC before start convert

//Read ADC Value    

ADC10CTL0   &= ~ADC10IFG;       //Clear Cvt Complete flag

    ADC10CTL0   |=  (ENC + ADC10SC);        //Start cvting

    while((ADC10CTL0 & ADC10IFG) == 0){}   //Wait until cvt finish

    uwPwrADC   =   ADC10MEM;        //Read Cvt Result

So here uwPwrADC is the ADC Value. Can anybody tell me why ADC cannot get the correct value? Is my code error? Thanks a lot.


Viewing all articles
Browse latest Browse all 262198

Trending Articles



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