Quote Originally Posted by RFsolution
Hi

This is what I have but dont see any light in "my" tunnel

OSCCON = $60
DEFINE OSC 4
DEFINE adc_bits 10
DEFINE adc_clock 3
DEFINE adc_sampleus 50

adcresult VAR WORD
dummy var word
adcon1=%100000010
maxvalue var word
minvalue var word
scale var word
result_64 var word

init:
maxvalue = 64000 'this is 359,8 degrees
minvalue = 2200 ' this is equal to 0 degrees

.....

You have 10bits of res. Thus you need the result as right justified. But you have adcon1=%100000010 one extra 0 is typed here. So the result becomes as left justified. Thus you get your results as 64000 and 2200.

Change it to adcon1=%10000010. So you now have correct right justified setting.

Then check the readings again.



-------------