
Originally Posted by
lerameur
I have light to voltage chip,
That's a SOLAR CELL! 
reading the encoder, the encoder is divided into 4 sections, 2 white and two black, read black show ADC below 127 and white ADC above 127.
I get the feeling you might end up making a small program just to test the ability of your sensor to read the black/white patches in the first place rather than assuming your sensor/PIC will read everything the way you hope it will. Something like this:
Code:
........setup.........
ledout var port...some port here
main: adcon0.2=1 'Start Conversion
waitonadc: if adcon0.2 = 1 then waitonadc
oldoutput_pot = adresh *256 + adresl
if oldoutput_pot > 127 then
ledout = 1
else
ledout = 0
endif
goto main
Change the value 127 above to find a 'trip point' for the counter itself.
See what happens with that. If that works for you, then you should be all set.
(Also, you may want to check the manual for your use of the ADCIN command)
Bookmarks