1

I am building a pH meter and having a real close look into the analog components, and reading the Arduino documentation for analogRead(). https://www.arduino.cc/en/Reference/AnalogRead

I see it says the Arduino, in my case an 8-bit AVR ATmega328 Arduino Uno, yields a resolution between readings of: 5 volts / 1024 units or, .0049.

My question is whether that is accurate, or even possible. How can an 8-bit MCU provide a 10-bit analog read? how does that work?

Shouldn't the analog read be 2^8 or 256?

per1234
4,2782 gold badges24 silver badges43 bronze badges
asked Jun 24, 2015 at 10:33

1 Answer 1

4

It can do a 10-bit reading quite simply - because the ADC is a 10-bit ADC. The CPU register size doesn't dictate what it can communicate with, either internally or externally. The only thing it dictates is how big a number it can cope with at any one time. Because of this the 10-bit result of the ADC is spread across two registers - 2 bits in the "high" ADC result register, and 8 bits in the "low" ADC result register.

answered Jun 24, 2015 at 11:52
2
  • 2
    ...or two bits in the 'low' and 'eight' in the high. You can decide which within your code. The purpose of this is to allow you to easily 'downscale' your 10-bit ADC result to 8-bit : With the eight most-significant-bits in one register you can use one single read command to get your result. This can be useful if you don't need a 10-bit resolution, for example if the input is so noisy that the lowest bits become irrelevant. Commented Jun 24, 2015 at 12:38
  • 3
    @chaaarlie2 Also the left-alignment option gives you in effect a 16-bit value (though with 6 lowest bits static) which is very useful if using standard mathematical algorithms etc that expect a 16-bit value. Means you don't have to do any expensive shifting of each and every sample. Commented Jun 24, 2015 at 15:13

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.