Questions about using the A to D


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,635


    Did you find this post helpful? Yes | No

    Default Re: Questions about using the A to D

    my wish is to set port B.0 to be the analog input (pin 8)
    portb.0 is an4 use
    ADCIN 4, adval ' Read channel 0 to adval
    and set adcon1 to %00010000


    there is no need to use tris to set the pin to an input just use adcon1 to make it analogue

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Questions about using the A to D

    Hi,
    and set adcon1 to %00010000
    Hmm.... I think you've got that backwards...
    Looking at the 18F1320 datasheet, ADCON1 defaults to 0 which means that AN0-AN6 are all analog. If AN4 is the ONLY pin to be used as analog you need ADCON1 = %11101111

    /Henrik.

  3. #3
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Questions about using the A to D

    Quote Originally Posted by richard View Post
    there is no need to use tris to set the pin to an input just use adcon1 to make it analogue
    From the datasheet
    17.6 Configuring Analog Port Pins
    The ADCON1, TRISA and TRISB registers all configure
    the A/D port pins. The port pins needed as analog inputs
    must have their corresponding TRIS bits set (input). If
    the TRIS bit is cleared (output), the digital output level
    (VOH or VOL) will be converted
    .

    Which I read as saying tris has to be set along with adcon1 to make it analogue?

Similar Threads

  1. PicKit 2 Questions
    By dmairspotter in forum General
    Replies: 3
    Last Post: - 11th November 2007, 21:10
  2. 2 questions
    By Archangel in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 1st December 2006, 02:47
  3. Serial questions
    By Armando Herjim in forum Serial
    Replies: 0
    Last Post: - 29th June 2006, 19:49
  4. New with questions
    By Terke in forum General
    Replies: 5
    Last Post: - 6th December 2005, 06:35
  5. Questions?
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd June 2005, 14:44

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