Using the Pot command.


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2009
    Posts
    33

    Default 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.

  2. #2
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    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

  3. #3
    Join Date
    Aug 2009
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    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.

  4. #4
    Join Date
    Aug 2009
    Posts
    33


    Did you find this post helpful? Yes | No

    Default 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.

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Aug 2009
    Posts
    33


    Did you find this post helpful? Yes | No

    Default 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.

Similar Threads

  1. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 20:31
  2. PBP2.50b and POT command problem ?
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th October 2008, 17:14
  3. Replies: 4
    Last Post: - 24th January 2007, 22:20
  4. pot command
    By lerameur in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 25th November 2006, 04:12
  5. Can I do this???
    By noobie in forum mel PIC BASIC
    Replies: 2
    Last Post: - 10th June 2006, 18:57

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts