16F876 : settings for 40Mhz


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    ok, i now have a 18f242 with the possibilty to clock with 40mhz. and i have read the manual with the pll section. now i know that i must configure something the FOSC bit to multiple with 4. how i do that exactly in PBPro or with a assembly line inside?

    thanks a lot for an explanation. greetings from a geek

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


    Did you find this post helpful? Yes | No

    Default

    you must se configuration fuse and add a DEFINE OSC 40 at the top of your code

    look here to know how to define your config fuses

    the end of your 18f242.inc file look like this
    Code:
    ;Configuration Byte 1H Options
    _OSCS_ON_1H        EQU  H'DF'	; Oscillator Switch enable
    _OSCS_OFF_1H       EQU  H'FF'
    _LP_OSC_1H         EQU  H'F8'	; Oscillator type
    _XT_OSC_1H         EQU  H'F9'
    _HS_OSC_1H         EQU  H'FA'
    _RC_OSC_1H         EQU  H'FB'
    _EC_OSC_1H         EQU  H'FC'	; External Clock w/OSC2 output divide by 4
    _ECIO_OSC_1H       EQU  H'FD'	; w/OSC2 as an IO pin (RA6)
    _HSPLL_OSC_1H      EQU  H'FE'	; HS PLL
    _RCIO_OSC_1H       EQU  H'FF'	; RC w/OSC2 as an IO pin (RA6)
    so _HSPLL_OSC_1H have to be choose
    Steve

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

  3. #3
    Join Date
    Jan 2005
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    thanks for your support.

    my file starts so :

    @ __config _HSPLL_OSC_1H

    DEFINE OSC 40


    i compile with the mpasm and get this error message :
    [126] .. : argument out of range (not a valid config register address)

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


    Did you find this post helpful? Yes | No

    Default

    NOP.... Read the bottom of your .inc file. you must write...

    @ __CONFIG _CONFIG1H, _HSPLL_OSC_1H
    DEFINE OSC 40

    what about now
    Steve

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

  5. #5
    Join Date
    Jan 2005
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    first i got two error messages about "overwriting previous address content" which i fixed with comment out the line "_CONFIG1H......" in 18F242.inc from the PBP root.

    for testing i work with a simple programm which blinking a led. it works..., but the pause command is 4 times slower then it should be. so, it seems the pic works with the 10mhz from the external oscillator, not with the 40mhz i wish.
    in the melabs programmer i've set the oscillator to HS as HSPLL too for testing, the result is the same. what can be wrong again?

    thanks a lot for a support

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


    Did you find this post helpful? Yes | No

    Default

    That's strange. I'm not 100% of what i say but, looks like your programmer don't program the configuration bits for your device.

    What's happening if you use a 20 MHZ oscillator and use HS mode???

    what about now if you use a 4mhz and and use XT mode???
    Steve

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

  7. #7
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Whether you set the config bits in your program or not, you should be capable of setting those bits manually prior to burning the PIC. If your programmer is incapable of doing that, you may need a sortware update for it, or alternatively you might need a better programmer.

Similar Threads

  1. 16F876 ADCON,CMcon,Tris settings
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 10th March 2010, 20:32
  2. Config settings
    By Adrian in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th December 2007, 18:24
  3. 16F876 Usart Receive
    By syscoder in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 21st March 2007, 15:43
  4. Changing Settings ???
    By tico in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 28th December 2006, 03:10
  5. Need help with migration 16F876 -> 18F252
    By NavMicroSystems in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 24th February 2004, 16:22

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