Using ADCIN or POT/RCTIME?


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Posts
    92

    Default Using ADCIN or POT/RCTIME?

    Hi,

    I just started using the pics and pbp 2.46. I programmed a pic12f683 using adcin to read the value of a couple of pots. I noticed that there is a time lag from the moment when I turn the pot and the response of the pic, which in this case is oscillating the pic with the SOUND command.

    I'll turn the pot to adjust the frequency of the note, a new note will sound but only after a time lag. Is this just the nature of using adcin? I thought it was supposed to be very fast and accurate when compared to using the POT or RCTIME commands. Would these other commands be better for reading the value of a pot?

    Also, I was wondering if you could use adcin with a different circuit other than a voltage divider circuit.

    Thanks in adavance.
    Tony

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Tony,

    ADCIN & the PIC's internal ADC are actually pretty fast, but the sound
    command, depending on the note/duration time, can be relatively slow.

    RCTIME just measures the time a pin stays in a particular state. POT would
    work, but it's really a pain to calibrate.

    The time lag you're seeing is most likely due to the time it takes to generate
    sound.

    You can adjust the sample time for A/D readings by using the PBP
    DEFINE ADC_SAMPLEUS option as long as it stays within the parameters
    shown in the PIC data sheet for A/D acquisition time.

    The default is 50uS unless otherwise specified with DEFINE ADC_SAMPLEUS.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    I see, so it's the SOUND command that's taking the time.

    What about using the ADCIN with a pot using a different circuit than the voltage divider that's shown in the books. Is it possible to use other circuits with a pot and ADCIN?

    Thanks again,
    Tony

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    PIC A/D inputs can be connected directly to the analog source. You don't
    need any voltage dividers unless the analog input is greater than Vcc.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    So I can just connect one part of the pot to the pic pin and the other to ground?

    Or if using a photocell, one lead to pin the other to ground?

    I was laboring under the notion that there had to be that voltage divider that I've seen in some books where one pot pin goes to +5, the other to ground and the middle pin to the pic ADCIN pin.

    Tony

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    If you have an analog signal from some external device, say, a temperature
    sensor or something else, that outputs an analog voltage, then you can
    connect this analog source directly to the PIC A/D input.

    If you're using a potentiometer to simulate the external analog signal, then of
    course you'll want one end to Vcc, the other to ground, and the wiper to the
    PIC A/D input.

    Without one leg of the potentiometer to Vcc you wouldn't have anything but
    ground on the PIC A/D input.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. ADCIN and PIC18F4331 Arghhhhh !
    By GrandPa in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th December 2010, 20:27
  2. How to make adcin stable?
    By Pic2008 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 20th January 2009, 07:41
  3. ADCIN problems with PIC16F73
    By passion1 in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 26th July 2007, 11:38
  4. Adcin or Pot
    By lerameur in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 11th January 2007, 16:46
  5. help using adcin
    By harryweb in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 31st January 2006, 07:46

Members who have read this thread : 0

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