ADC_Clock Vs ADCON0


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2005
    Location
    So Cal and loving it
    Posts
    40

    Default ADC_Clock Vs ADCON0

    Hi,

    Just trying to get to grips with my first project using ADC using a 16F73 and have a quick couple of questions.
    After looking at other code examples on this forum and reading the datasheet my question is.... is there any point using a define adc_clock 2 and a adcono =%10000001? From what I can understand the adcono will set my clock speed bits to %10(2) anyway.
    What is the correct way to use these two statments?

    'Includes
    INCLUDE "modedefs.bas"

    'Definitions
    define OSC 20
    DEFINE ADC_BITS 8
    DEFINE ADC_CLOCK 2
    DEFINE ADC_SAMPLEUS 100

    'Initialize chip and Ports
    ADCON1 = %00000100
    ADCON0 = %10000001

    Thank you

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default

    Hi, Locko

    You just define twice your ADC clock frequency ...

    DEFINE is just needed if you use the PbP ADCIN Statement ... which cares about ALL others ADCON0 Bits !!!

    See PbP "Samples" section ( on the CD ...) for further explanations.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    If you're using ADCIN, then TRIS and ADCON1 are the only registers you need to mess with.
    PBP knows the clock setting from DEFINE ADC_CLOCK ? and handles ADCON0 for you.
    Regards,

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

  4. #4
    Join Date
    Dec 2005
    Location
    So Cal and loving it
    Posts
    40


    Did you find this post helpful? Yes | No

    Default

    Thanks for the replies guys,

    I thought it was doubling up on the settings. I was going to use the adcin command so will drop the adcon0 from my prog. as well as check out the samples on the cd.

    Is that the same for most PBP commands, can I forget about setting the registers manually?

    Regards,

    Paul

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


    Did you find this post helpful? Yes | No

    Default

    Is that the same for most PBP commands, can I forget about setting the registers manually?
    No. There are still some registers you'll want to configure manually. Depending on the PIC
    and command. Pretty much everything is covered in the manual for each command, but if
    you have questions, post them here.
    Regards,

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

Similar Threads

  1. I am confuse
    By timseven in forum mel PIC BASIC
    Replies: 19
    Last Post: - 23rd October 2009, 15:49
  2. A/d 16f88
    By Steves in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 31st May 2009, 01:19
  3. Problem with 16f88 steep motor control
    By ken_23 in forum Off Topic
    Replies: 0
    Last Post: - 4th July 2008, 12:25
  4. voltage monitor
    By aftab in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 17th August 2007, 09:57
  5. Code entering endless loop
    By Blackhawk in forum mel PIC BASIC
    Replies: 11
    Last Post: - 26th November 2006, 09:12

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