Acin command on 16F876, unable to read on AN1


Closed Thread
Results 1 to 3 of 3
  1. #1
    krapoto's Avatar
    krapoto Guest

    Default Acin command on 16F876, unable to read on AN1

    Hello,
    I try to use the Adcin function on a 16F876 device, it's work nice only on port AN0 and I can't read on Port AN1, AN2, AN3... ?
    I use PBP 2.42a .

    Thanks for your help or Idea.


    My code :
    '
    DEFINE OSC 20
    DEFINE ADC_BITS 10
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 10

    TRISA = %11111111 ' Set PORTA to all input
    ADCON1 = %10000000 ' Right justify

    ADIN VAR PORTA.1 ' work nice with PORTA.0 !!!
    ADVAL VAR WORD

    ADCIN ADIN,ADVAL
    adval = (adval */ 500)>>2

    '

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


    Did you find this post helpful? Yes | No

    Default

    First you must write the channel numer you want to read instead of the PIN name
    ADCIN 0, Avar
    ADCIN 1, AnotherVar
    Steve

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

  3. #3
    krapoto's Avatar
    krapoto Guest


    Did you find this post helpful? Yes | No

    Thumbs up Adcin

    Hi Steve,
    Thank you for your advice, it's work fine now !

    Charles


    Quote Originally Posted by mister_e
    First you must write the channel numer you want to read instead of the PIN name
    ADCIN 0, Avar
    ADCIN 1, AnotherVar

Similar Threads

  1. Cleaning up code
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2009, 07:14
  2. SEROUT WORD variable problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th April 2009, 11:20
  3. Write and Read from eeprom
    By savnik in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 9th June 2007, 14:56
  4. Changing declared variables names on the fly
    By jessey in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 16th December 2006, 06:34
  5. Problems with 16F876 on interrupts an WRITE / READ
    By BigWumpus in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th December 2005, 14:38

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