how to read 10 bit value of adc in pic 16f877a


Results 1 to 3 of 3

Threaded View

  1. #3
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default

    As I always do, let me preface by saying I'm a noob with little surety, a modest desire to help, and an immense desire learn. It is my hope that by making a sincere effort to solve your problem, it will be one I do not have to make for myself

    Looking at page 128 of the datasheet, it would appear your ADCON1 register is bunged:

    Your setting: ADCON1 = %000111, appears to me to left justify the two high bits with ADCON1.7 = 0; I should think it would be easier to manipulate an ADC value with all the bits right justified (ADCON1.7 = 1). Also, the right bits (0-3) are A/D port configuration control bits - they set which channels are ADC, which are the Vref+/- channels, and which are digitals. There are two settings which RESEMBLE your configuration:

    '011X', which disables ADC (making all channels digital) and '1111' which sets AN0 as analog, AN2 as vRef- and AN3 as vRef+. This appears to be what you want...

    So, if my evaluation is correct, 001111 is the correct ADCON1 register configuration setting for 1 ADC channel, 10 bit resolution, right justified. Do you read it this way as well?

    Actually, in better looking at the choices (doh) it appears that 001110, sets AN0 analog - without vRefs. Time to edit had expired...
    Last edited by Archangel; - 1st November 2014 at 19:05. Reason: poster ran out of edit time

Similar Threads

  1. ADC and SEEPROM on 16F877A
    By Digitaldood in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 8th January 2013, 17:49
  2. Replies: 2
    Last Post: - 22nd May 2012, 06:45
  3. 12 bit or higher ADC on a PIC that works with PBP?
    By Brandon in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th November 2007, 17:19
  4. Flash PIC with 12 bit ADC
    By Steve_88 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th October 2007, 20:35
  5. Read the newbee threads, 16F877A no go.
    By BobbyA in forum mel PIC BASIC Pro
    Replies: 39
    Last Post: - 31st December 2006, 03:09

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