-
Using the Pot command.
Hi there I have a question related to the Pot command (I am using a 16F628 and PicBasic Pro). I am trying to compare the light intensities of four light sensors (4 infrared leds as sensors) . When these infrared leds are exposed directly to the sun light they put out about one volt dc. To be able to compare these voltages I am using the Pot cmd. I know that the Pot cmd is used to measure resistance not voltage but if the voltage applied to the R/C network varies the resistance will also varies accordingly to that voltage. I have read in a book that the voltage supplied by the Pot cmd. to the R/C network could be internal or external. The problem here is that if I feed an external voltage (one volt dc coming from the leds) to that circuit how can I make the Pot cmd send a 0 instead of a 1 before it reads the pin port again. In other words, the Pot cmd feeds it’s R/C network sending a 1 and then it reads the port to measure the time the cap took to fully charge. In my case I am sending the 1 from the leds. Do you know how make the Pot cmd send a 0 instead of a 1 or do you have a better idea? Thanks.
-
Hi,
For the application you have described, why not use LDRs instead of LEDs? They give a far more linear response over a wider spectrum.
Also, in my experience, the pot command used on different pins give a different reading. That is, for the same intensity, and even assuming all 4 of your LDRs are charachteristically identical, you are likely to get different readings on different pins, even on the same port.
Look at this thread for a possible solution: http://www.picbasic.co.uk/forum/showthread.php?p=70591
To avoid these hassles, why not use a pic with ADCs?
Regards,
Anand Dhuru
-
Well, looks like I'll have to go with LDRs and find a way to calibrate every one of it on each pin because I want to use the 16F628 and learn it the best I can before I try more powerful PICs. Thanks for your teaching and your time, very appreciated.
-
A new approach...
Hi: Reading the PIC 16F628 datasheet I found out that this PIC has two analog comparators on Port A. The explanation on that datasheet is a little confused for me and I need a little help to understand how could I use these comparator within PicBasic Pro for my project. They explain that the output of these comparators are read from the register CMCON and I have no idea of how can I access this register from Picbasic Pro. I would like to know how or where to find instructions or programs examples to learn how to use these comparators. Thanks a million.
-
-
Thanks,
Thanks to both of you for your help. I have learn a lot from the information you gave me. My project is going perfect and my programming without a glitch. Thank you again.