I am trying to read a digital output from a conversion from the ADCH register but i am being told that the ADCH register is invalid. Now, How can I transfer the contents of ADCH to a general purpose register.

Here is the code that I used. It is written in AVR Assebmly language.

.include "m168def.inc"
.org 0

ldi r17,96
sts ADMUX,R17

ldi r18,215
sts ADCSRA,r18

ldi r19,1
sts PRR,r19

ldi r21,255
out DDRD,r21
mov r20,ADCH
out PORTD,r20



I'm not up to speed on that chip but...
Are you allowed to set the ADEN and clear the ADFR bits simultaneously or in sequence?
After setting the states you should initiate the conversion process
Set bit 6 in ADSC
WAIT until ADCSRA bit 6 goes low!
Then read ADCL first, before reading ADCH.