configuring AD converter in a 12F615


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    klantz12's Avatar
    klantz12 Guest


    Did you find this post helpful? Yes | No

    Default Re: configuring AD converter in a 12F615

    Can anyone help me with configuring the AD converter in 16F877A on the labX1 board? I am using MicroCode Studio-pbp and i have tried the following code from the help button and from another post i read.


    ADCON1=132 ' 128 + 4 = %10000100 'Left just 3 analog inputs rest digital
    TrisA = 255 'all inputs for the a to d
    Define ADC_BITS 10 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (rc = 3)
    Define ADC_SAMPLEUS 50 ' Set sampling time in microseconds

    AdcIn 1, W0
    AdcIn 3, W1


    The error says that ADCIN needs a variable.

    My assignment is just to read the AD input from the three potentiometers at A0 A1 and A3.

    Pretty lost. Thanks! also, i didnt know how to start a new thread so sorry for posting in ya'lls.

    Kay

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


    Did you find this post helpful? Yes | No

    Default Re: configuring AD converter in a 12F615

    didnt know how to start a new thread so sorry for posting in ya'lls.
    Big button near the top of forum pages, "+ Post New Thread".
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default Re: configuring AD converter in a 12F615

    AdcIn 1, W0
    AdcIn 3, W1

    The error says that ADCIN needs a variable.

    Kay, I'm assuming that you have migrated to the PIC world from Basic Stamps and you may not have defined your variables - something you do not need to do in Stamps. So you need:

    W0 var byte

    to define W0 as a byte variable - these definitions usually go near the top of the page.
    "Do or do not, there is no try" Yoda

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: configuring AD converter in a 12F615

    For 10-bit A/D you'll want to define W0 & W1 as WORD sized vars...;o)
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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