Analog input on 18f252


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2009
    Location
    LECCE - ITALY
    Posts
    7

    Default Analog input on 18f252

    Hi,
    I need to set port RA3 (pin 5 on 18f252) in analog mode to read a level of battery.
    Now I have ADCON1 = 7 (all input in digital mode)
    What Value I need for ADCON0 and ADCON1 to get RA3 in analog mode only?
    Thanks

    Roberto

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


    Did you find this post helpful? Yes | No

    Default

    There's no way to set ONLY AN3 as analog input on a 252.

    The closest you can get is ADCON1 = %10000100 which sets AN0, AN1 and AN3 to analog mode.

    If you can move that input to AN0, then you can set ONLY AN0 to analog mode with ADCON1 = %10001110.
    <br>
    DT

  3. #3
    Join Date
    Jan 2009
    Location
    LECCE - ITALY
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Thankyou so much Darrel,
    I must change the wires on my pcb to set AN0 in analog input
    bye


    Quote Originally Posted by Darrel Taylor View Post
    There's no way to set ONLY AN3 as analog input on a 252.

    The closest you can get is ADCON1 = %10000100 which sets AN0, AN1 and AN3 to analog mode.

    If you can move that input to AN0, then you can set ONLY AN0 to analog mode with ADCON1 = %10001110.
    <br>

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. Analog Input on PIC16F88
    By penelopepug in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th May 2008, 22:49
  3. 16f88 - pin RA4 as analog input
    By savnik in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 15th December 2006, 13:55
  4. Analog pins for digital input
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th September 2005, 00:32
  5. 16F88 reading Analog Input
    By thunderstrike44 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th August 2004, 22:41

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