it is in the code above:

with this it works:
ADCON1 = %00000010
Define ADC_BITS 10 ' Set number of bits in result


but not:

ADCON1 = %10000010
Define ADC_BITS 8 ' Set number of bits in result