20X2 readadc LDR

unigamer

Member
OK so I have an LDR set up as in the manual except I have a 10k resistor not a 100k. (I did originally have a 150k attached and it wasn't working but I hadn't got the code right anyway I don't think)

The ldr goes into ADC 8, (that's B.0 and leg 14). With my code

Code:
let dirsB = %00000000
let adcsetup = %0000000100100110

main:

readadc 8, w0 ' right eye LDR

pause 100
debug
goto main

[code]

From the debug it flickers between a value of 1 and 4. It's like it hasn't been grounded with a resistor but it has been! With a multimeter the LDR seems to be working perfectly. The voltage at the leg varies as light changes.

I have two other ADCs being used that work perfectly. Very confused - any help much appreciated!
 

sghioto

Senior Member
unigamer said "The ldr goes into ADC 8, (that's B.0 and leg 14)."

The ADC 8 input is leg #8 on the 20X2 also C.2

Steve G.
 
Top