10 bits ADCIN with 18F2520


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: 10 bits ADCIN with 18F2520

    This is for a different chip but it might help. I like dealing with the registers directly, an example of both are here.
    http://www.picbasic.co.uk/forum/show...9694#post79694
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: 10 bits ADCIN with 18F2520

    This works for 10-bit A/D on an 18F2520, using 9600 baud serial to a PC to view the results.
    Code:
    DEFINE OSC 40
    
    SerPin VAR PORTC.6
    
    DEFINE ADC_BITS 10  ; 10-bit results
    ADCON2.7 = 1        ; right justify
    
    ADval  VAR WORD
    
    Main:
        ADCIN 0, ADval
        SEROUT2 SerPin, 84,[DEC ADval,13,10]
        PAUSE 500
    GOTO Main
    DT

  3. #3
    Join Date
    Oct 2010
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: 10 bits ADCIN with 18F2520

    Thanks to all...
    I will try the code and I will reply!
    Stefano

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts