16F876 : settings for 40Mhz


Closed Thread
Results 1 to 20 of 20
  1. #1
    Join Date
    Jan 2005
    Posts
    72

    Default 16F876 : settings for 40Mhz

    hello

    would somebody be so nice to tell me step by step what are the settings for 40mhz operation? i'm work with a 10 mhz resonator and searched at the net for the right information... where can i find such depth informations by myself?

    thanks a lot

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


    Did you find this post helpful? Yes | No

    Default

    You're out of luck, there is no 40MHz setting for this part.

    As far as I am aware, the 16F876 only goes to 20MHz (and then you need a 20MHz xtal).

    Some 18F parts have an internal x4 PLL which will allow you to run at 40MHz with a 10MHz xtal, but the 16F876 does not have that feature.

    Always check the PIC's Datasheet which you can download from the Microchip website.

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Mel

    This thread points off a basic question ...
    Do someone hereby have any experience about PIC ( real ...) overclocking ???

    Results, maybe, could be interesting ...

    Alain

  4. #4
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Alain,

    I have 4MHz chips running absolutely stable @ 8MHz,
    but I have never tried to overclock a 20MHz chip.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Smile

    Hi, Ralph

    Yesss, I remember we already had a discussion about "4 Mhz" stamped chips ... that are , in fact, not verified 20 Mhz chips.

    Just as my Pentium III 1200 runs quietly at 1287 Mhz ...

    here the question is really : What happends at more than 20 Mhz for 20 Mhz max. chips ??? ... and also what happends to 18 F series if XTAL is more than 10 Mhz ...
    Correct timing will be the next step ...

    My toaster becomes old ... I hope hot plastic smelling not too awful ...

    Alain

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


    Did you find this post helpful? Yes | No

    Default

    If it's for your own project, go try it. If it works, then fine. If it dies, then no harms done (unless it's your own personal Pacemaker you're modifying!). I'm kinda boring - I almost never build things to exceed manufacturers component specs - it's a sure road to disaster.

    If it's a marketable product for sale, DON'T. It's bad practice to run at (or beyond) maximum ratings (apart from the fact that you'll almost certainly invalidate your Public Liability Insurance!).

    If you buy a car sold as capable of 160mph, then you would like to know that it'll do that all day long regardless of ambient conditions. Would you be happy knowing that when you reach 160mph it's within 0.1% of blowing it's head (or worse)?

    Kiddies (and techies who should know better) like to tinker and overclock their PC's for example... then halfway through a major piece of work it has a cardiac and they end up crying into their coffee about the f****** PC and how much work they've lost. Go down this road and it's your own fault if things go wrong or you end up wasting heaps of time chasing your own tail. I'm not saying it doesn't work, but I am saying you are skating on thin ice.

    Just as my Pentium III 1200 runs quietly at 1287 Mhz ...
    Hmmm... a 4MHz PIC running at 8MHz could be compared to your P3-1200 runing at 2400MHz... might have some reliability issues here...

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Smile

    HI, Mel, you're a real Mother for me, ( note here I'm very young today ( no peacemaker rqd )... Yeaaahhh , frenchies .... !!!)

    Seriously, that kind of game ( really a game !!! ) is not to be used on security devices, nor sold !!!
    My last car was a Honda civic 130 HP ... and ran only once at 180 Km/h intead of 201 . I was late for the first inspection !!! never went over 140 for the 14 following Years.
    I now do recommend you the European Accord ... really, really great. - and wonderful if talking electronics ...

    Back to Pics, remember those kind of treatments are only for my lab experiments, I perfectly know about components lifetime ... and use them aboard MY model planes ...

    And never drink coffee nor else around my computer ...I assembled it myself, and don't want to crash or destroy it Stupidly.

    Best regards
    Alain

    PS : for computer overclocking ... we won't discuss upon Windows tremendous qualities ... Why do I still run W98 SE ??? ....
    Last edited by Acetronics2; - 29th March 2005 at 13:40.

  8. #8
    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

  9. #9
    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.

  10. #10
    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)

  11. #11
    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.

  12. #12
    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

  13. #13
    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.

  14. #14
    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.

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


    Did you find this post helpful? Yes | No

    Default

    that's for sure Melanie. But i think you can setup Melabs programmer to write configuration bits or not... i'm really not sure of what i say. Maybe some EPIC user or Bruce can second this ?
    Steve

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

  16. #16
    Join Date
    Jan 2005
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    first of all, thanks to steve and melanie for their feedback and help.
    unfortunalety is doesn't work better.

    i have this versions :
    MicroCode Studio Plus 2.1.07
    PicBasic Pro 2.44
    MPASM 3.90 (updated today from 3.50)
    melabs Serial Programmer 3.13 (updated today from 3.10)
    firmware of the programmer 3.5 (updated today from 3.2)

    my code is this :

    @ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HSPLL_OSC_1H

    DEFINE OSC 40

    led var porta.0

    init:
    clear
    TRISA = %00000000
    PORTA = 0


    main:
    high led
    pause 1000
    low led
    pause 1000

    GOTO main

    END

    in the 18f242.inc file of the pbp root, i set line 20 as follow :
    ; __CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H

    assembled with MPASM 3.90, getting no errors and no warnings. nothing.

    problem : if i set the osc to 10, it works fine. when i set the osc to 40,
    it works 4 times slower. (i work with a 10 mhz at a 18f242 and capacitors
    with 22pf). in the melabs settings i test hs as osc as well as the hspll.
    both settings have the same effect.

    many thanks for any comment and idea...

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


    Did you find this post helpful? Yes | No

    Default

    It really looks like your programmer don't set the configuration fuses...

    i don't have any 18F252, but this one is tested with a 18F452
    Code:
    @ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HSPLL_OSC_1H
        ' Oscillator switch OFF
        ' Use HSPLL (fosc X 4) oscillator  (10mhz here)
        '
    @ __CONFIG _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L & _BORV_45_2L
        ' Brown out reset ON @ 4.5Volts
        ' Power-up timer ON
        '
    @ __CONFIG _CONFIG2H, _WDT_ON_2H 
        ' Watch dog timer ON
        '
    @ __CONFIG _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
        ' Stack over/underflow ON
        ' Low Voltage programming OFF
        ' Background debugger OFF
        
    Define OSC 40
    Start:
          Toggle PORTC.3
          pauseus 100
          goto start
    if you change the DEFINE OSC 40 to DEFINE OSC 10 you'll get 25uSec pulses. So PLL is working very well.

    Look into your Melabs programmer setings, must have a place to configure programmer options.

    If you can't find something like that, send an e-mail to BRUCE from Reynolds Electronics. [email protected] For sure he know the solution for that.
    Last edited by mister_e; - 4th April 2005 at 20:31.
    Steve

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

  18. #18
    Join Date
    Jan 2005
    Posts
    72


    Did you find this post helpful? Yes | No

    Default it works

    steve, thanks a lot for the example. this is working very well!

    after that my own example works too. unfortunalety i don't know why... i think it was a configuration at the melabs programmer.

    once again : thanks all for the support

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


    Did you find this post helpful? Yes | No

    Default

    mischl

    great to know it's working now.

    Have fun!
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    With the melabs serial programmer make sure you have these two
    menu options selected.

    Update Configuration From File
    Reread File Before Programming

    This makes sure you are always getting the latest version of the .hex
    file & whatever config word changes you make programmed into the
    target.

    Also, I recommend inserting "every" config word option the target has.
    This way there is no doubt how each option is configured.

    With all of the advanced configuration options the 18F series has, It's in
    your best interest to know exactly how every option is set. Accepting a
    default un-programmed state may cause you problems.

    For the 18F series I comment out every default setting in the PBP device
    header file, and insert my own config fuse settings in my source.
    Regards,

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

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 : 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