adcon problems with adcin


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2006
    Posts
    76

    Default adcon problems with adcin

    Hello everyone,

    I have a simple question: I am trying to use the adcin command to get input from a pot source on a 18F4550. I am hacing problems with the defines and setting it up. I assume I want to use "DEFINE ADC_BITS 10" but I am unsure about what else I should do.

    DEFINE ADC_SAMPLEUS 10 '(or 50?) What exactly is this?
    DEFINE ADC_CLOCK 3 'I am assuming I should use this because I am using a crystal?

    And the biggest mystery...the adcon.

    I looked at the datasheet for the PIC18F4550 on adcon1 and I don't really understand it. Can anyone help me here or give me a link to a web page or something? Thanks for your help.

    -Mike

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


    Did you find this post helpful? Yes | No

    Default

    Wich channel you want to read?

    Wich OSC speed?
    Steve

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

  3. #3
    Join Date
    Jul 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    I would like to read all channels. And I am using a 20mHz crystal, although I know I need a DEFINE OSC 20 for that. What I don't understand is how to read the tables in the datasheet and how to set the defines for adcon and adcin. Thank you for your response.

    -Mike

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


    Did you find this post helpful? Yes | No

    Default

    OK then, so you're not going to use the USB feature in?

    Let me know, i have some spare time today... to be honest, i'm out of solution to fix my actual Projects bugs.... ARRGGHHHH! Seems i need a break
    Steve

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

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Hi,
    I use this:

    DEFINE OSC 4
    DEFINE ADC_BITS 8
    DEFINE ADC_SAMPLEUS 50
    ' Set clock source (3=rc)
    DEFINE ADC_CLOCK 3


    ......................

    for counter2 = 0 to 7
    SUM = 0
    FOR COUNTER1 = 1 to 10

    ADCIN counter2,A[counter2]

    PAUSEUS 24 'Pause between ADCINs

    SUM = SUM + A[counter2]

    NEXT COUNTER1

    A[counter2] = SUM/10


    And is working very good.

    Regard.

  6. #6
    Join Date
    Jul 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    I might use the USB feature... I don't know if I need the feature right now though.

    I think I will use this code...but are the adc_bits and adc_sampleus numbers arbitrary?

    DEFINE OSC 4
    DEFINE ADC_BITS 8
    DEFINE ADC_SAMPLEUS 50
    ' Set clock source (3=rc)
    DEFINE ADC_CLOCK 3

    And mister_e I could use your expertise on a few questions: I am using an infrared emitter and the strength of that beam will be measured by an infrared receiver (which will be measured with the adcin command). However, I cannot seem to find an infrared receiver. Do you know of any online stores that sell them?

    The other thing I need are really cheap gearhead motors. Any suggestions?

    Last question: If I do end up using the USB feature, what software could I use to receive USB data (or should I write my own) which I can then process?

    I appreciate your help and wish you luck with your own projects.

    -Mike

  7. #7
    Join Date
    Jul 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    Does anyone have a link or know of an article about this where I could go to?

    -Mike

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 setup help need
    By dangill in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 26th February 2008, 15:22
  3. ADCIN problems with PIC16F73
    By passion1 in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 26th July 2007, 11:38
  4. Problems with MicroCode Studio ICD
    By Muzza in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th July 2006, 02:37
  5. help using adcin
    By harryweb in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 31st January 2006, 07:46

Members who have read this thread : 1

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