16F88 + 2 Analog inputs


Results 1 to 9 of 9

Threaded View

  1. #2
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    adcin PORTA.1,vall
    This is a syntax error that compiles.

    You need to use the analog CHANNEL number, NOT the port PIN number.

    The hex value of PORTA is $05. Setting the bit to .0, .1, or .3 might set it to 0 or 1, but no matter what Port pin you use, you will never get a port number greater than 1 if you are using a bit value.

    The hex value of analog channel 0 (AN0) is 0, and that's what you need to be using. It may have helped to read the HELP file:
    ADCIN 0, B0 ' Read channel 0 to B0

    So the hex values are valid to compile, but when they are placed into the ANSEL register, you don't get the results you were expecting.

    Bottom line: Use the channel number, which is the "x" value of the ANx number on the pin diagrams. This is pretty simple had you looked at the HELP file.
    ADCIN 0, B0 ' Read channel 0 to B0


    Have fun!
    Last edited by tenaja; - 4th June 2010 at 21:45.

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