PDA

View Full Version : cds on 16f877a



chip_1
- 18th May 2005, 07:44
Hi all,
on 16F84A this code works fine.
-----------------------------------------
v1 var byte

main:

pot portb.0,255,v1 ' connect an CDS (fotoresistor)
if v1 < 230 then led
goto main

led:

high portd.1
pause 500
low portd.1
pause 500
goto main
---------------------------------------
on 16F877A no works!!
why?

thx
chip_1

Dave
- 18th May 2005, 12:01
Chip_1, I beleive the resistance of CDS Photoresistors are quite high as I remember. If the resistance you are encountering is much more than say 50k Ohms then the pot command will not work. You could possibly use the RCTIME command instead with and appropriate capacitor.....

Dave Purola,
N8NTA

mister_e
- 19th May 2005, 17:25
Or using the internal analog to digital converter with a op-amp[ buffer between CDS and the PIC.

Be sure you place a 0.1 uF capacitor close to your PIC.

Is anything else work with this PIC?