Strange A/D conversion...


Results 1 to 5 of 5

Threaded View

  1. #1
    Christos_K's Avatar
    Christos_K Guest

    Default Strange A/D conversion...

    Hi all! Have been trying to do a 10bit A/D conversion using a PIC16f876 but something strange happens...I have a working circuit and send the result through RS232 to my pc...I use a potentiometer with the two ends connected at Vdd and GND and the other end is connected to PORTA.0...Look at some measurements i did..The first values are from my digital multimeter and the second values are the decimal value of the a/d conversion variable...

    5V --> 1023 (5v)
    4V --> 785 (3.8v)
    3V --> 552 (2.7v)
    2V --> 300 (1.47v)
    1v --> 65 (0.3v)
    0v --> 0 (0v)

    As you can see the A/D conversion can show the max and minimum values but it is lost in between..
    Here is my code(reference votlage is set to Vdd = 5V):

    DEFINE HSER_RCSTA 90h '
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_SPBRG 129
    DEFINE HSER_CLROERR 1

    DEFINE OSC 20

    DEFINE ADC_BITS 10
    DEFINE ADC_CLOCK 2 (tried 3 but didn;t work)
    DEFINE ADC_SAMPLEUS 50 (tried increasing but didn;t work)

    adcdata var WORD
    trisa = %11111111

    ADCON1 = %10000010

    main:

    ADCIN 0, ADCDATA

    hserout [dec ADCDATA ,13]

    pause 1000

    goto main


    What can be wrong?? I 've also tried a version where you manual set the conversion to start and checking the bit2 of adcon0 etc etc but same results...
    Also tried with 3.3V reference voltage at PortA but still no luck...
    Last edited by Christos_K; - 31st May 2005 at 02:21.

Similar Threads

  1. A/D conversion with PIC18F67J50
    By ScaleRobotics in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th May 2009, 01:48
  2. Fast / low resolution A/D conversion
    By AndrewC in forum General
    Replies: 7
    Last Post: - 7th April 2009, 12:18
  3. A/D conversion problem in 18F2520, 2523, 2550 etc.
    By selimkara in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 10th March 2008, 16:26
  4. A/D conversion problem on 18F4431
    By ttease in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th April 2007, 23:03
  5. A/D converter fails?
    By egberttheone in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 13th February 2006, 18:57

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