Hi,
If your reference voltage is 5V and you're feeding in 5V on the analog input the ADC will return the value 1023. Since a 10 bit value need two bytes (ADRESH and ADRESL) to "fit" you can choose if the result should be left or right justified within those two bytes containing the result.
Code:
ADRESH ADRESL
00000011 11111111 <-This is right justified, result is "pushed toward the right" within the two bytes
11111111 11000000 <-This is left justified, result is "pushed towards the left" within the two bytes
The red digits represnts the most significant bit in the result
If you read the result by combining the high and low byte into a word when the result is left justified you'll get 65572 instead 1023.
/Henrik.
Bookmarks