Mehmet Fide

12 bit ADC returns 3009 for VDD?

Discussion created by Mehmet Fide on Feb 9, 2007
Latest reply on Feb 13, 2007 by Alban Rampon
I've  two batteries in my application to measure with ADC. I have some questions.
The function below returns 1483 when I select the channel as internal bandgap reference that is 1.2V. This is ok because 4095 * 1,2V / 1483 = 3.3V that is my MCU and ADC supply. If I choose the channel as VDD, VDDA, VDDSW or VDDASW (I don't excatly know what are the differences between them), same function returns 3009 for me and this correspond to 3009 * 1.2V / 1483 = 2.44V. I was expecting its to return 4095. Why does this happen?
If the MCU and ADC high reference voltages are same and 3.3V, and if AD0 channel is connected to a battery that is 3.6V over a 1K resistor, what should the function return for AD0 channel? Isn't it 4095?
MCU is under Non Disclosure Agreement !
unsigned int ReadADCChannel(unsigned char ch){  unsigned char i, resh, resl;  unsigned int result, total = 0;    //low power, fbus/4, long sample, 12bit, BusClk(fBus=~6.2Mhz)  ADCCFG = 0b11010100;     ADCSC2 = 0;  ch &= 0b00011111; // choose the channel    for(i=0; i < 16; i++)  {        ADCSC1 = ch;      while(!ADCSC1_COCO);      resh = ADCRH;    resl = ADCRL;    result = ((unsigned int)resh << 8) | resl;    total += result;  }    ADCSC1 = 0b00011111; // module disable      return(total / 16);}

Alban removed NDA info

Message Edited by Alban on 2007-02-09 09:00 PM