Selection of analog ports


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2005
    Location
    Palmdale, CA
    Posts
    37

    Default Selection of analog ports

    Looking at the table for the PCFG3:PCFG0 bits in the ADCON1 register in the Microchip mid range refence handbook (PIC16F876), it appears that you can't select one of the higher order channel numbers as analog input without selecting the ones below as analog as well. In other words, can I use port A3 as analog input and ports A2:A0 for digital? I just want to be sure I'm reading the table correctly.

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default I'm on shakey ground here

    But I think so look at the attachment.
    JS
    Attached Images Attached Images  

  3. #3
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    You are reading the table correctly, but ...

    If you do not care what RA0-RA1 are doing when you are doing your ADC on RA3, then yes, you can have your cake and eat it to.

    ADCON1 = 7 ' all digital
    do stuff here that requires RA0-RA2 to be digital
    ADCON1 = 132 ' RA0, RA1, RA3 = analog, RA2 = digital
    do your conversion on RA3 (see Datasheet section 11.3 so that you can see what RA0 RA1 are doing)
    ADCON1 = 7 ' all digital again
    etc.

    Why not use the option where RA0 = analog and the rest digital? (i.e., why not swap your RA3 and RA0 pins assignments?
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Whew

    Quote Originally Posted by paul borgmeier View Post
    You are reading the table correctly, but ...


    Why not use the option where RA0 = analog and the rest digital? (i.e., why not swap your RA3 and RA0 pins assignments?
    Thanks Paul,
    boy I was sure hoping someone who knows what they are talking about would ring in on this one
    JS

Similar Threads

  1. pic18f analog comparator problem
    By david.silaghi in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th May 2009, 09:38
  2. Replies: 4
    Last Post: - 17th April 2009, 08:56
  3. Replies: 1
    Last Post: - 29th September 2007, 18:05
  4. analog inputs on 16F716
    By schwinn_rider in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th October 2005, 04:07
  5. making ports outputs on a 12F629
    By bartman in forum mel PIC BASIC
    Replies: 2
    Last Post: - 14th November 2004, 17:47

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