Ich habe im Datenblatt vom 328P gelesen und tatsächlich noch etwas gefunden:
28.7. ADC Conversion Result
After the conversion is complete (ADCSRA.ADIF is set), the conversion result can be found in the ADC
Result Registers (ADCL, ADCH).
For single ended conversion, the result is
ADC = Vin x 1024 / Vref
where VIN is the voltage on the selected input pin, and VREF the selected voltage reference (see also
descriptions of ADMUX.REFSn and ADMUX.MUX). 0x000 represents analog ground, and 0x3FF
represents the selected reference voltage minus one LSB.
Und ich habe für mich nachgerechnet
Code:
Schritt 1:
----------
geg: Vin = Vref = 5V
5V / 1024 = 0,0048828125V
5V - 0,0048828125 = 4,9951171875V
Schritt 2:
----------
geg: Vin = 4,9951171875V
Vref = 5V
ADC = 4,9951171875V x 1024 / 5V
ADC = 1023
Probe:
1023 x 5V / 1024 = 4,9951171875V
Ergo
-----
ADC x 5V / 1024 = Vin
bzw.
Vin = ADC x Vref / 1024
Nachtrag:
Datenblatt unter: ADC Conversion Result (Abschnitt 28.7 - ATmega328P, 26.7 - ATmega640-1280-1281-2560-2561).
Beim ATmega640 ... gibt es noch eine Tabelle "Correlation Between Input Voltage and Output Codes".
Lesezeichen