16F819 ADCIN Channel Select?


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2005
    Posts
    96

    Default 16F819 ADCIN Channel Select?

    If I am setting up a 16F819 chip to read only three of the analog pins on portA how do I select the Channel in (ADCIN channel, var)? In my application, see code below, I am using pins AN0,AN1,and, AN3 as analog and the rest of portA as digital.

    Basically my question is does the channel increment as if every pin in portA is analog and thus AN3 would be channel 3? or would it be channel 2 in this application since AN2 is set up as digital?



    trisa=%10001011

    DEFINE ADC_BITS 16 ' Set number of bits in result
    DEFINE ADC_CLOCK 3 ' Set clock source (rc = 3)
    DEFINE ADC_SAMPLEUS 50 ' Set sampling time in microseconds

    ADCON1 = %10000100 ' PORTA AN0,AN1,AN3 are analog
    ADCIN 3, variable


    Thanks for any help

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    If you look into the PBP manual in the ADCIN section and read the example at the bottom... ADCIN 0.... will read channel 0 or AN0

    look to your datasheet.. a/d converter don't gives you 16 bit results.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Apr 2005
    Posts
    96


    Did you find this post helpful? Yes | No

    Default

    I realized I had 16 instead of 10 bits after I posted it, but I am still confused on the ADCIN channel.

    I realize ADCIN 0,variable will read the analog voltage in from pin AN0, but when I set the ADCON1 register up so that AN0, AN1, and AN3 are all analog how do I read from AN3?

    Is it ADCIN 3, variable or ADCIN 2, variable. or do I need to be doing something with the ADCON0 register that I am not doing?

    Thanks again

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    ADCIN 0,VAR_0 'read channel 0...AN0
    ADCIN 1,VAR_1 'read channel 1...AN1
    ADCIN 3,VAR_3 'read channel 3...AN3

    nothing else to modify IMO
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Sony SIRC IR Issue
    By Ryan7777 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th August 2015, 08:10
  2. Multiplexer channel selection
    By Castor in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 19th May 2008, 10:51
  3. select case question
    By ronjodu in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th March 2006, 10:01
  4. 18F1320 ADC multiple channel select
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 28th November 2005, 21:40
  5. Interrupt/timer not really interrupting...
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd May 2005, 22:05

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