Might have to run the PIC faster. 4Mhz...cap is probably discharging before you even get a chance to see it.
I did a project awhile back where I used an LED as a touch sensor, basically read the residual voltage across an LED after 'charging' it. An LED has X amount of junction cap's, and it can be varied a bit by the amount of ambient light hitting the surface of the LED...
Anywho's, long story short, I tried it at 4Mhz, didn't work, no matter how tight I made the code. Capacitance was discharging faster than I could read it. Sped the PIC up to 40Mhz, worked like a champ.
EDIT: Disregard...I just noticed you were using a 16C65B... Wow! That's old school. There's a lot of newer options out there. Options that include built in comparators, ADC's, and so on...run faster, use less power, and so on...
Bookmarks