A little friendly chat is never a bad idea. After all it was me who asked for a description, remember?
Re "Cool idea": Well I don't know what you mean, maybe because I am not the youngest. Please explain.
I just added the ldr and unfortunately the +5V->LDR->IO-Pin-idea does not work. The voltage levels are not within the specified High/Low-Levels of the PIC. I found that Light means 1kOhms and None means from 8-16kOhms.
So I added a resistor of 4.7kOhms:
+5V->LDR->IO-Pin->4.7kOhms->Mass. Now there are voltage levels of about 3.2 and 2.3 Volts, which is still not within the specification.
Now I am planning to use the integrated Comparator but I do not know how, yet. What are the fuses?
On a 16f628 I guess it is CMCON=%11001010 for the PIN on RA2 but what about VREF. How to activate that in the high range?
Try the RCTIME code I posted. It should work since it sounds like the resistance values for your ldr are bascally the same a the CDS Cell I am using. I have no resistor though, just connected directly between the pin and 5V.
"cool" is a slang term that sort of means "neat" or "interesting". Again, sorry about that. I'm not used to being on a forum that has so much input from different countries. It is really "cool"! ;-)
Gary
I succeeded simply by using a check whether the PIN is High or Low - without the comparator.
I am using BluTak to connect the ldr to the led and it works.......marvelously.
Silent movement of the servo coming closer to the button. Then the servo softly moves forward and as soon as the camera reacts it stops. No matter in which position the cam is, it always stops gently. Simply awesome. I am excited.
Last edited by Ted's; - 15th May 2008 at 06:11.
I would think a person would want to read that pin a number of times though, a kind of 'software hysteresis', just to make sure the pin isn't jumping 0 to 1 to 0 to 1, and causing something to go a bit flakey......unless of course the jumping around is what you're looking for!![]()
The 16F628a does not have a ADC. The difference between using the IO pin vs the comparator-module is the non-defined space between about 2,5 and 4 volts.
That means that within this area the PIC could percieve a high as a low and vv. This problem does not occur when using the comparator, so in the long run the comparator is better. I guess this is what skimast said aswell.
So let us come back to the comparator. The LDR is connected to RA2. Which fuses are needed to make RA2 connect to the (non-)inverting input, the other input to vref and to disable the other comparator? I am adressing all of you.
Bookmarks