Help with DS18B20 program


Closed Thread
Results 1 to 39 of 39

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Do you have A/D disabled for RB4?
    Have NO idea

    Would you mind letting me know if I should disable it or not? And if I should disable it, how to do it? [Did I mention I'm a complete newbie at this? ]

    ADCON0.0=0 sounds right? (Page 233 fo 18F2620's datasheet)

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


    Did you find this post helpful? Yes | No

    Default

    You interface a digital device, your I/O must follow this requirement.

    ADCON0 refer to the analog to digital converter, not a bad idea to do so. Look a bit later in the datasheet (ADCON1) and you'll discover to how enable/disable it on specific I/O.

    If my memory serves me well, i think you can also disable PORTB analog in the config fuses as well.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Post

    If you plan to use a pin that has A/D on it for digital I/O, then you for sure want to disable
    the A/D feature for that pin. Otherwise it reads as 0.

    ADCON1 = 15 turns off all A/D. See the data sheet REGISTER 19-2: ADCON1: A/D CONTROL
    REGISTER 1 section.

    Where you see a D in the A/D Port Configuration Control Bits chart, this indicates Digital for
    that pin. Where you see an A, this indicates the pin is configured for Analog.

    Another option is to use PBADEN config bit. If PBADEN = 0 then AN0-AN7 are analog by default at POR
    (power on reset). AN8 to AN12 are digital. If PBADEN = 1 then PCFG 2 to 0 = 1, which means AN0 to AN12
    pins are analog

    Look at the chart in your data sheet. If ADCON1 = 0 then all pins with analog capabilities are
    Analog. If ADCON1 = 15 what are they?
    Last edited by Bruce; - 19th November 2007 at 22:32.
    Regards,

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

  4. #4
    Join Date
    Nov 2007
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    If ADCON1 = 15 what are they?
    They are ALL digital, right?

    Yeah - I was just reading about ADCON1 on the datasheet and seems like I should try again with ADCON1=15 at the beginning of my program. That will turn RB4 (which is also AN11) into a digital port (along with all the other A/Ds). My fingers are itching to try this out, but alas I don't have my programmer with me. Can't wait to try it out when I go home. Man, this stuff is addicting!

    Thanks Bruce!
    Last edited by presario1425; - 19th November 2007 at 22:43.

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


    Did you find this post helpful? Yes | No

    Default

    They are ALL digital, right?
    You're 100% correct. Easy stuff isn't it.?

    Man, this stuff is addicting!
    It really is..;o}

    Just remember, the data sheet is all you really need beyond the PBP manual. Lookup the
    value you need to place in a peripheral register to configure it to work the way you want
    it to, and BINGO you're off to the races.

    It really is that simple.
    Regards,

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

Similar Threads

  1. Presetting Configuration Fuses (PIC Defines) into your Program
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 82
    Last Post: - 15th December 2013, 09:54
  2. Replies: 1
    Last Post: - 23rd May 2009, 09:22
  3. Compile and Program help using PICKit2
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 10th March 2009, 14:51
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. PIC16F684 Program question
    By Nicholas in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th December 2006, 14:30

Members who have read this thread : 2

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