I think the justification is ok... if you want to use the ADC in 8-bit mode then you want it to be left-justified (ADFM=0)
and just read the ADRESH register, disgarding the lower bits in ADRESL.
I think the problem is in the section that averages the readingsHere DataW must be a WORD since you're adding 8 byte values together which could give you 8 x 255 = 2040.Code:' Quanticise, discarding top and bottom FOUR elements ' ---------------------------------------------------- DataW = 0 For CounterA = 4 to 11 DataW = DataW+RawData(CounterA) Next CounterA ADCInVal = DataW>>3 ' Divide Result by EIGHT




Bookmarks