Hello Bruce,
Thanks for the info, I was really getting frustrated with the pot command and finding a proper value of a photo resistor to use.I found that the adc works great with just about any photo resistor value.
Also thanks TonyA and your right that the adc does work best for this type of application and it is very fast too, I'm pleased to see. I'm also using an 18f452 (great micro) but not with the ADCin command and it works great.
Code:
Check_The_Light_Level:
adcon1=%00001110 ' AN0 analog, all other pins digital
ADCON0 = $41 ' Set A/D to Fosc/8, Channel 0, On
Pauseus 50 ' Wait for channel to setup
ADCON0.2 = 1 ' Start conversion
Pauseus 50 ' Wait for conversion
Lite_Level = ADRESH
ADCON1 = 7 ' shut off (Disable) ADC
RETURN
Once again thanks everyone for getting me kick started on this.
Thanks
jessey
Bookmarks