Perhaps the added load on the power supply in the second program (the USB flash drive) is enough to shift the ADC result by the 15mV or so that you are seeing.
The ADC converts inputs ratiometrically with respect to the power supply and ground. The temp sensor provides an absolute voltage output with respect to ground, however. So if the ADC power supply voltage changes even slightly, the temp sensor output will convert to a different number (even though the temperature has not changed).
You could try an experiment: Connect a 1.5V flashlight battery with its negative end to ground and its positive end to another analog input pin (say, p16). This provides an absolute voltage reference. Read this voltage at p16 with your first program, then again with your second program.
If they differ by 15mV or so, you have confirmed the problem. If the readings are the same, you have ruled out this hypothesis...
Hi all, I noticed that the sensor MCP9700A reads a different value of temperatures with the following two programs.
The first program is:
The output of this is:
The second program is:
The output is:
The two part for the read of the temperature are similar but there is a difference of 1.5°C.
Someone can help me for resolve this problem??
PS: the room temperature read by another thermometer is 26.1°C.
Thanks