adcin issues with 16f676


Results 1 to 3 of 3

Threaded View

  1. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    967


    Did you find this post helpful? Yes | No

    Default

    This reply is how I read the ADC in a 16F876A. I guess the registers and the reading would be the same in the 16F676, but I haven't read the datasheet and can't vouch for it.

    Code:
    Scanspeed   var word    ' this is where we read the ADC value
    
            ADCON0.2 = 1      ' Start conversion
            while ADCON0.2    ' wait till conversion is done
            wend
            ScanSpeed.HighByte = ADRESH
            ScanSpeed.LowByte = ADRESL
    Also, you need to heed this warning (from the PBP manual)
    Code:
    Before ADCIN can be used, the appropriate TRIS register must be set to
    make the desired pins inputs.  ADCON1 also needs to be set to assign
    the desired pins to analog inputs and in some cases to set the result
    format and clock source.

    Hope this helps
    Jerson
    Last edited by Jerson; - 5th November 2007 at 03:43. Reason: Warning note added

Similar Threads

  1. ADCIN and PIC18F4331 Arghhhhh !
    By GrandPa in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th December 2010, 20:27
  2. ADCIN Problem
    By JavPar in forum General
    Replies: 33
    Last Post: - 20th January 2009, 03:36
  3. ADCIN problems with PIC16F73
    By passion1 in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 26th July 2007, 11:38
  4. help using adcin
    By harryweb in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 31st January 2006, 07:46
  5. PIC12F675 and ADCIn
    By Peter1960 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th February 2005, 07:42

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