I need to read 3 pots with a 16f627 and came across using an RC network. (The next version of my project is based on a 16f877 so it'll have proper ADC) The theory made sense to me, drive a high voltage into the line and wait to see how long it took the cap to discharge through the resistor and to bring the pin low... ...until I saw the schematic. This is where I get very confused. (The schematic has a CDS cell but mine will have a slide pot wired as a variable resistor.) 1. When there is no light hitting the resistor, wouldn't this allow (as wired) am excessive amount of current to flow? 2. Why would the pin go low at all at the lower levels of resistance? Is it that this circuit is dependent on the resistance never going below a certain value? Everytime I start to think I'm getting a grip on the basics, something like this comes along and confuses the hell out of me
A light resistor never has a (near) zero resistance. It's always more like: 5k ohm when no light hitting it, 10k ohm when light hitting it; or the other way around. So there's never a situation in which an excessive amount of current would flow. I can't answer your other questions though, don't know enough for that .
It could kind of work, but you would have to make sure it was a Schmitt trigger pin and not a TTL pin, because a TTL changes from low to high at a certain voltages, so that wouldn't do you any good. Schmitt trigger, has a 2 voltages, one high and one low, a voltage above the high is a 1 a voltage below the low is a 0 anything in the middle is floating.
Aha! That makes some sense to me. I wasn't aware that CDS resistors had so much resistance at dark. Thanks!
You could always take the easy way out and just use the 12F675 if this method gets too difficult/confusing.
I'm trying to use what I have, a couple of olimex 18-pin protoboards, and a dozen or so 16f627fs. I've gotten too many 2nd day air orders over the last couple weeks and I need to cap my spending. (Though I'm building quite an inventory ) I also really need to get my car back together. I'm going to replace the brains in the next month or so with a new board that will have lots of functionality. I'll be using the HW ADC in the next version. I have the 16f877s now, but I don't want to build out the circuit just yet. I was just confused about the CDS as it looked like a potential short. (And suprise, suprise, if I hooked my pots that way, it would have been. Maybe it is sticking after all )
I'm not quite sure I understand your question here. What you do is you make that I/O pin an output, and bring it high. Then make the I/O pin an input and immediately start using one of the timers to test until the pin goes low. The pin will go low because the capacitor will slowly (or quickly) charge through the resistor.
My question was that if the resistance (CDS in this circuit) was very low (1 or 2 ohms), why would the input drop to 0 at all as there is a connection from VCC to ground. I wasn't aware that a CDS cell in the dark still had a high resistance.
There's no connection between Vcc and Ground even if it did have a resistance of 0 ohms. The capacitor blocks DC once charged, so if the LDR had a resistance of 0 ohms, the capacitor would charge up almost immediately, and the voltage at the input would become 0V.
AAAAAAAAAAHHHH!! This would be one of those giant holes in my understanding, I was crossing with AC. I didn't realize that the flow stopped with DC. Now the above circuit makes perfect sense. Thanks for setting me straight