Hello,
I've been reading some threads about the LED's capacity feature and that they can be used as "sensors".
Now, I made a short program where I involve 3 LEDs to be discharged and measured in time like this:
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1583&stc=1&d=117804885 4">
The shema is simple: one port connected to all Anodes (through a 330 ohms resistor) and three ports connected each to one Kathode. I use a 16F88 @ 20MHz.
I reduced the code as much as I could and here it is:
Code:
LOOP:
for Counter = 1 to 3
PORTB.0 = 0 : PORTB.0(counter) = 1 'reverse power to the LED to "charge" it
TRISB.0(counter) = 1 'make the last HIGH port an Input and...
while PORTB.0(counter) = 1 '...read it. As long as port is 1, increment "Discharge"
discharge = discharge + 1
wend
discharge(counter) = discharge 'store Discharge's value for later comparision
discharge = 0
next
gosub display
TRISB = 0
goto loop
end
I know I can reduce the overall process time by modifying the program but this is currently not the problem since I want to reduce the discharge time of each LED.
I thought I would be able to lower the LED's capacitance by reducing the voltage applied to it. So I put a 10K instead of the 330ohms one.
I even added a 10Mohms resistor in parallel with the LED to make a kind of load.
Result: no change(!?). The time values never change.
What am I doing wrong here? Should I use a 40MHz PIC instead?
Bookmarks