Hello,
On K20-50MHz-48pin, I'm working on an ADC implementation based on the example code. I'm simply trying to read two thermistors in a voltage divider circuit. For each thermistor there is a circuit from voltage reference 1.2V -> 10K resistor -> (ADC Test Point) -> thermistor connector -> ground.
For testing purposes I selected the voltage reference and the internal temp sensor as my two channels and I get this result:
ADC A: 65211, 1.194 V
ADC B: 39329, 0.720 V
Those are 0.006/1.2 = 0.5% and .001/0.719 = 0.1% errors.
When I configure the same software to read the external pins, with no thermistor connected, I get horrible results. With thermistor connector open, the ADC input should be 1.2V. It is simply connected through the 10K pullup to the reference voltage of 1.2V. However, I get the following:
ADC A: 49642, 0.909 V
ADC B: 51216, 0.938 V
I measure it with a scope and a DMM and both show 1.2V.
Attaching my driver code. It uses the adc16.c and adc16.h files from the example code.
Any ideas?
Original Attachment has been moved to: adc.h.zip
Original Attachment has been moved to: adc.c.zip