Trouble understanding ADC values when using external Vref- and Vref+

NVHLVNOP

Member
I'm using and external Vref+ and Vref- for the first time on the 40X2 chip. When debugging, I'm getting values not what I would have expected.

My sensor give a voltage output that will range between 4.1 to 4.7 volts. I want to maximize the resolution of the ADC for this range, so I set up 4V on the Vref- ADC pin and 4.8V on the Vref+ pin. All my ADC readings were coming in as zero.

I started varying the Vref- and Vref+ voltages and here's what I got. My sensor output at the ADC pin was constant at 4.55V for this whole exercise...

Vref- | Vref+ ADC reading
3.22 | 4.80 | 229
3.37 | 4.80 | 191
3.41 | 4.80 | 31
3.45 | 4.80 | 5
3.51 | 4.80 | 0

3.22 | 4.94 | 210
3.23 | 4.69 | 247
3.23 | 4.66 | 253

I expected the value to be calculated as (Sensor voltage - Vref-) / (Vref+ - Vref-) * 255.

When Vref+ was 4.8, any Vref- above 3.51 would yield ADC value of zero. Any idea how I can bring it closer to 4.0V? How is the ADC value calculated when using external references?
 
Top