Setting up ADC....


Closed Thread
Results 1 to 2 of 2
  1. #1
    robertmark68's Avatar
    robertmark68 Guest

    Default Setting up ADC....

    OK

    I've been at this a while now and I don't seem to be getting anywhere...

    Time to ask the gurus

    I'm trying to set up a 16F877A to read AN0...

    This is what I have so far:

    DEFINE ADC_BITS 8 'Set # of bits
    DEFINE ADC_CLOCK 3 'Set clock source (rc=3)
    DEFINE ADC_SAMPLEUS 50 'Set sampling time in usec

    I want to use an external +VREF, so i set ADCON1 like this (per the pic manual)

    ADCON1 %00000001 'sets ADC to use AN3 as +VREF & GND as -VREF

    The problem I am running into is there is a voltage approx 3V coming out of the pin that I want to input my +VREF on! This is not good.

    Anyone have any ideas?

    Robert

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Robert,

    I'm guessing that you are using an O-scope to see that voltage.

    With the pin "Floating", and a High impeadance scope probe, it will balance out somewhere around midway between 0 and VDD just from the leakage currents.

    A simple test is to put a 1k resistor from the pin to ground. The voltage should go away. You don't need that resistor for normal operation though.

    With the ADCON1 setting you gave you should be OK to put a voltage on AN3. But if you are only using AN0, you might want to change it to %00000101 to open up some more digital pins.
    <br>
    DT

Similar Threads

  1. Stable Adc Reading Routine
    By gebillpap in forum General
    Replies: 27
    Last Post: - 13th May 2015, 03:18
  2. PICKit2 - warning about configuration words
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 4th August 2009, 15:01
  3. Setting Address via ADC
    By breesy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th October 2007, 15:33
  4. Setting Up Adc Ports
    By GEEZER in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 22nd August 2005, 04:04
  5. 12F675 ADC 'Issues'
    By harrisondp in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st March 2005, 02:55

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