"964" is wrong - of course... taken from ADC3 - see before
So I think something is there wrong with any registers reading the values from ADC, depending on what - no idea...
ADC can not be used without any error correction in this time - must be checked multiple times for getting a reliable result.
Code as reference is attached - the setting back to input mode is from other sketch - it must be used, because of after analogRead the port will be set to output and give back to ADC source a high level voltage...
I was using the ADC and was confused about the error rate (wrong given values). That's why I tried to isolate the problem.
Made a simple sketch using 4 different analog inputs: ADC0 - reference voltage source ADC1 - 50% VCC output ADC2 - 50% 5V output ADC3 - 1.5V battery
Made > 7500 loops reading the values ADC0;ADC1;ADC2;ADC3. Right values like this:
I got for the reference voltage (ADC0) following result:
checking this I have seen such lines:
Seems value from last ADC3 was returned for ADC0 !
To be sure I have set the value for ADC3 to 0V (GND) and checked again:
Additional have got some (not only a few) strange results for ADC3 (connected to GND):
Then have removed the reading of ADC3 (no difference set the pin to input or not) - result:
"964" is wrong - of course... taken from ADC3 - see before
So I think something is there wrong with any registers reading the values from ADC, depending on what - no idea...
ADC can not be used without any error correction in this time - must be checked multiple times for getting a reliable result.
Code as reference is attached - the setting back to input mode is from other sketch - it must be used, because of after analogRead the port will be set to output and give back to ADC source a high level voltage...
ZUNO_ADC_test.txt
Michael