ADC setup on 12F1822 ??


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: ADC setup on 12F1822 ??

    This may be obvious but since you didn't post your code I'll say it anyway.
    The variable you're putting the result in is declared as a WORD, right?

    /Henrik.

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: ADC setup on 12F1822 ??

    looks like "Occam's Razor" may have struck again

  3. #3
    Join Date
    Mar 2008
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: ADC setup on 12F1822 ??

    Quote Originally Posted by HenrikOlsson View Post
    ... The variable you're putting the result in is declared as a WORD, right? /Henrik.
    Yes, it's a WORD. But thanks!

  4. #4
    Join Date
    Sep 2008
    Location
    Maine, USA
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Re: ADC setup on 12F1822 ??

    Not sure if you figured this out, but 10bit AD need to be read out as RIGHT justified, and 8 bit reads should be LEFT justified. Here's a config that works for 8-bit:
    ADCON0.0 = 1 ' AD ON
    ANSELA = %00000001 ' select analog vs digital (1=analog)
    ADCON1.7 = 1 ' bit7 = 1 = LEFT justified
    define adc_bits 8 ' set ADC as 8 bit
    "Do or do not, there is no try" Yoda

  5. #5
    Join Date
    Mar 2008
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: ADC setup on 12F1822 ??

    Thank you^^^. Yes, I got it sorted out. I think my initial confusion resulted from some interaction between PBP3 DEFINEs for the ADC module and some direct settings I was also doing on some ADC-related registers. Everythings good now. Thanks again!
    Last edited by swr999; - 31st October 2014 at 00:08.

Similar Threads

  1. Help to setup ADC for 16F1826
    By SOTASOTA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th February 2014, 00:06
  2. 12F1822 troubles
    By Charlie in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th June 2012, 12:53
  3. 12F1822 embedded host?
    By dhouston in forum USB
    Replies: 5
    Last Post: - 18th September 2011, 18:14
  4. MIBAM and 12F1822...
    By alesniak in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 17th September 2011, 06:45
  5. ADC setup for 16F716
    By droptail in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th November 2009, 02:39

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