# how does an 8-bit AVR do 10-bit analog read?

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?

## 1 Answer

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.

• ...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. – CharlieHanson Jun 24 '15 at 12:38
• @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. – Majenko Jun 24 '15 at 15:13