Internal Oscillator and pull-up statements for 16f887


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Is this better?

    Hi Gusse

    Is this looking better ?

    Not sure of the Comparator setting ??

    Code:
    @__config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
     
    'Ocsillator selections here
      'OSCCON = %01100001 for 4mhz, or OSCCON = %01110001for 8mhz
            OSCCON = %01110001           'Int CLK 8MHz
            ANSEL= %11111111       '$0F = disable A/D converter
            cm1con   =   1 
            option_reg = 7     'switch pull-ups ON
    'END of oscillator selections
      'timer/oscillator defines 
            define osc 8        '8MHz
    'END of timer/oscillator defines

  2. #2
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Post

    Hi Dennis,

    I would try with following settings.
    Code:
    <code><font color="#008000">@__config _INTRC_OSC_NOCLKOUT &amp; _WDT_OFF &amp; _MCLRE_ON &amp; _LVP_OFF &amp; _CP_OFF
    
    </font>OSCCON = %01110001          <font color="#000080"><i>'Int CLK 8MHz
    </i></font>ANSEL = %00000000           <font color="#000080"><i>'All digital
    </i></font>OPTION_REG.7 = 0            <font color="#000080"><i>'Weak pull-ups enabled
    
    </i></font><b>DEFINE </b>OSC 8                <font color="#000080"><i>'8MHz</i></font></code>
    Comparators are disabled at POR, no need to disable twice.

    BR,
    -Gusse-

  3. #3


    Did you find this post helpful? Yes | No

    Default compile errors in MCS

    HI Gusse

    MCS won't allow a compile ....
    It seems to have a problem with this line
    Code:
    @__config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
    In particular with the first path or the line it seems ...
    Here's the error
    Warning [205]...Found directive in column 1.(__config)
    Error [126] c:......argument out of range (not a valid config register)
    :-(
    Should I rather set those in the include file ?
    And what about the comparator ? Haven't quite master the way to disable it , the manual mentions CMxCON...

    Kind regards

    Dennis
    Last edited by Dennis; - 23rd November 2009 at 20:04.

  4. #4


    Did you find this post helpful? Yes | No

    Default Fixed!

    Check the include file 16f887.inc
    and it has this line in any way ...
    Code:
    @__config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
    So I left the line out of the code since there's no need to replicate the config lines.... or am I wrong ?

    Now what about the option to disable the onboard comparators ?

    Kind regards

    Dennis

  5. #5
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Post

    I have never included fuses to PicBasic code, always modified INC-files.
    Delete line from code and check that you have following line in 16F887.INC

    Code:
    __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
    Comparators are off after Power On Reset (POR), so if you haven't enabled those, then they are disabled.

    BR,
    -Gusse-

  6. #6


    Did you find this post helpful? Yes | No

    Default Thanks Gusse

    Thank you for the guidance and help !!

    I have all set in the include file now! :-)

    All is working just fine :-)

    Kind regards

    Dennis

  7. #7
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Default

    Nice to follow your project
    Good Luck!

    BR,
    -Gusse-

  8. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Gusse View Post
    I have never included fuses to PicBasic code, always modified INC-files.
    Delete line from code and check that you have following line in 16F887.INC

    Code:
    __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
    Comparators are off after Power On Reset (POR), so if you haven't enabled those, then they are disabled.

    BR,
    -Gusse-
    I never Fail to include them. To include the configs in your code, open the .inc file and install a semicolon just before the default config so,
    Code:
    __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
    becomes
    Code:
    ;__config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
    save it and start including them in your code without error. This way you can quickly adjust them, if you want to change something.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  9. #9


    Did you find this post helpful? Yes | No

    Default Thank you

    Hi Joe

    Thanks a million for the reply and advice :-) ,much appreciated !

    Kind regards
    Dennis

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