16F684 ADC problem


Closed Thread
Results 1 to 5 of 5

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    http://ww1.microchip.com/downloads/e...f684%20data%22

    the link above will get you the data sheet, the code below is copied from the data sheet page 33 I believe it is what you need, I would add that input pin appears to require a pullup resistor too.
    ASM
    BCF STATUS,RP0 ; BANK 0
    CLRF PORTA ;Init PORTA
    MOVLW 07H ; Set RA >2:0> to
    MOVWF CMCON0 ;Digital I/O
    BSF STATUS, RP0 ;Bank 1
    CLRF ANSEL ;Digital I/O
    MOVLW 0Ch ;Set RA<3:2> as inputs
    MOVWF TRISA ; and set RA<5:4,1:0>

    BCF STATUS,RP0 ;Bank 0
    ENDASM

    if this turns out to be wrong, keep this in mind,
    I did all the typing for you

    JS
    More lost than many . . too dumb to know it, too darn old to care.

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


    Did you find this post helpful? Yes | No

    Default

    @MarkEdwards
    Your ANSEL setting is wrong. Try
    ANSEL %00011111
    Steve

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

  3. #3
    Join Date
    Jun 2005
    Posts
    53


    Did you find this post helpful? Yes | No

    Question ANSEL %00011111 didn't work

    Thanks MR E for the reply!

    pin 3 RA4, AN3 seems like it is an output because it is low impeadance.
    I am trying to measure 0 - 4 vdc and have a 10k series
    resistor and a .1uf capacitor. The voltage is loaded down
    on some boards, a few boards pin 3 seems to work.
    I figure I am missing some configuration setting or don't understand
    something. 3 other adc inputs work as expected.

    Mark

Similar Threads

  1. PIC18F2423, ADC problem
    By mistergh in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th March 2009, 01:31
  2. 16F684 AtoD problem
    By hell_pk in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 20th February 2009, 06:59
  3. Mutliple ADC problem with PIC16F877
    By andyto in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd October 2007, 17:47
  4. ADC problem with PIC16F917
    By eetech in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th March 2007, 21:22
  5. ADC problem
    By NacNud in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th December 2004, 02:27

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