Understanding Arduino Code - Left Adjust ADC?

5 years 5 days ago - 5 years 5 days ago #1756 by rkpx1
This line of code is found in several of the Arduino sketches:
input = ((ADC_high << 8 ) | ADC_low) + 0x8000;

I am a bit confused, as the ADC is set to be left-adjusted (according to ADMUX = 0x60;). Wouldn't this mean that in order to sum the ADC_high and ADC_low together, the instruction code should be ((ADCH << 2) | (ADCL >> 6))? As the code currently stands, it seems like the ADC should be right-adjusted instead. I am basing this off the ATmega328p datasheet (picture attached), and any clarification would be greatly appreciated!
Attachments:

Please Log in to join the conversation.

Time to create page: 0.056 seconds
Powered by Kunena Forum
Joomla SEF URLs by Artio