AnsweredAssumed Answered

ADC_AdaptPGA function in ADuCM360_demo_cn0338

Question asked by dante2608 on Feb 8, 2018
Latest reply on Feb 12, 2018 by R.L

static int ADC_AdaptPGA(signed long data, int pga)
{
for (auto a = 0; a < pga; ++a) {
if (abs(data) > (0x6aaaaaa >> a)) { /* 0x6aaaaaa = 500mV ADC code */
pga = a;
}
}

for (auto a = 7; a > pga; --a) {
if (abs(data) < (0xcaaaaaa >> a)) { /* 0xcaaaaaa = 950mV ADC code */
pga = a;
}
}

return pga;
}

 

-------------------------------------------------------------------------------

 

Can you help me to explain how 0x6aaaaaa  is equal to 500 mv in ADC code ? I understand how to convert from ADC reading back to raw voltage but I tried to put this value into my equation, it is different than 500 mV.

 

Thanks

Outcomes