16F877A with 20MHz XTAL not working?


Closed Thread
Results 1 to 13 of 13
  1. #1
    ustredna's Avatar
    ustredna Guest

    Unhappy 16F877A with 20MHz XTAL not working?

    Please help me, i designed a one board width 16F877A and 20MHz xtal.
    CPU not working.
    code is designed with DEFINE OSC 20

    4mhz xtal working perfect.
    DEFINE OSC 4

    why????

    please help me.

    16f877A - I/P - 20MHz (DEFINE OSC 20) - Don't work

  2. #2
    Join Date
    May 2004
    Location
    New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    Have you set the device configuration word (or 'fuse') to the appropriate value for the 20MHz osc?

    Arch
    "Data sheets? I ain't got no data sheets. I don't need no data sheets. I don't have to read any stinking data sheets!"

  3. #3
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130


    Did you find this post helpful? Yes | No

    Default Maybe?

    I had the same problem, I didn't set the option on the programmer to HS (High speed.) I used the MELabs programmer, just go under options and make sure the oscillator is set for HS. After that everything worked great. I'm assuming that you do have the correct capacitors on the crystal.

    Jerry.

  4. #4
    ustredna's Avatar
    ustredna Guest


    Did you find this post helpful? Yes | No

    Default

    i have 2x 22pF capacitor with XTAL.

  5. #5
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Same problem

    I also had the same problem, PIC16F877A I/P e3 sample from micrpchip,
    i set config. bit in programmer "HS" , but working only up to 4 MHZ

  6. #6
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130


    Did you find this post helpful? Yes | No

    Default Worth a look,

    I found this helpful, from the Microchip website;
    http://ww1.microchip.com/downloads/e...Doc/31002a.pdf
    I hope it helps.

    Jerry.

  7. #7


    Did you find this post helpful? Yes | No

    Default other circuit, same problem

    a try all configurarion in hardware and software, other forum, say that using a command for set de fuses, but, not work, my configuration word is 2F4A, in de code write:

    @ DEVICE HS_OSC
    @ DEVICE WDT_OFF
    @ DEVICE lvp_off
    Define OSC 20

    use other combination too:

    @ DEVICE HS_OSC
    @ DEVICE WDT_OFF
    Define OSC 20

    @ DEVICE HS_OSC
    @ DEVICE lvp_off
    Define OSC 20

    @ DEVICE HS_OSC
    Define OSC 20


    with osciloscope, obtain sin wave in pins 14 and 13 at 20 +- 0.8 Mhz, for test, program pic whit this:

    Prg:
    PortA = %01010
    PortB = %01010101

    pause 500
    hserout ["Prueba de envio 1",13]

    PortA = %10101
    PortB = %10101010

    pause 500
    hserout ["Prueba de envio 2",13," ",13]

    goto prg

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


    Did you find this post helpful? Yes | No

    Default POWER to the PIC !

    Hi ustredna,
    What everyone here is trying to explain, but not quite doing is this:
    The PIC oscillator requires a bit more power to operate at speeds above 4mhz.
    you set the program parameters to be correct in your code for the oscillator speed with your DEFINE OSC 20 statement, but you tell the programmer to enable the oscillator to use the high power setting with the config fuse, or by manualy selecting HS on the programmer's software, elsewise your Oscillator is not going to work.
    JS
    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
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    Last edited by JD123; - 13th March 2008 at 23:06.

  10. #10
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default

    you will have to edit your 16F877A.inc file as below.

    NOLIST
    ifdef PM_USED
    LIST
    include 'M16F87xA.INC' ; PM header
    device pic16F877A, HS_osc, wdt_OFF, lvp_off, protect_ON , CP_ON
    XALL
    NOLIST
    else
    LIST
    LIST p = 16F877A, r = dec, w = -302
    INCLUDE "P16F877A.INC" ; MPASM Header
    __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF
    NOLIST
    endif
    LIST

    Your 16F877A will work on 20Mhz.

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


    Did you find this post helpful? Yes | No

    Default My Opinion

    Quote Originally Posted by precision View Post
    you will have to edit your 16F877A.inc file as below.

    NOLIST
    ifdef PM_USED
    LIST
    include 'M16F87xA.INC' ; PM header
    device pic16F877A, HS_osc, wdt_OFF, lvp_off, protect_ON , CP_ON
    XALL
    NOLIST
    else
    LIST
    LIST p = 16F877A, r = dec, w = -302
    INCLUDE "P16F877A.INC" ; MPASM Header
    __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF
    NOLIST
    endif
    LIST

    Your 16F877A will work on 20Mhz.
    Hi ustredna,
    The file mentioned above is included into your code automaticly when you compile using PBP and it contains "Default Settings" for your config statements, so if you do not include config statements in YOUR CODE it will default to the settings in this file. If you change the settings here it will DEFAULT to whatever you set here. Now for my opinion: I would not change the default to 20 mhz, I would instead simply put a semicolon at the beginning of the config statements so as to make the compiler overlook them as comments, and then include my own config statements in "MY CODE" every time.
    JS
    edit: Oh BTW, each PIC type has it's own file like this.
    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.

  12. #12


    Did you find this post helpful? Yes | No

    Default My experience on this

    Hi,

    Ive the same problem, i thange the crystal, caps, code... and nothing (at 1st time when y bought it works on 20mhz).Then today i went to the store ans bougt one pic more, caps, clocks. The problem was on the the 1st pic!!! i was not very good only acepts 4mhz clocks.


  13. #13
    Join Date
    Feb 2011
    Location
    Kuantan, Pahang, Malaysia
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: 16F877A with 20MHz XTAL not working?

    Quote Originally Posted by precision View Post
    you will have to edit your 16F877A.inc file as below.

    NOLIST
    ifdef PM_USED
    LIST
    include 'M16F87xA.INC' ; PM header
    device pic16F877A, HS_osc, wdt_OFF, lvp_off, protect_ON , CP_ON
    XALL
    NOLIST
    else
    LIST
    LIST p = 16F877A, r = dec, w = -302
    INCLUDE "P16F877A.INC" ; MPASM Header
    __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF
    NOLIST
    endif
    LIST

    Your 16F877A will work on 20Mhz.
    thx, this one works.

Similar Threads

  1. First time with external oscillator - 16F877a Not working
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 15th October 2009, 17:14
  2. 16F877a, stopped working
    By comwarrior in forum General
    Replies: 2
    Last Post: - 18th September 2009, 06:39
  3. 16F877 vs. 16F877A
    By DavyJones in forum General
    Replies: 12
    Last Post: - 11th April 2009, 18:22
  4. Pls How can I make 16F877A use 15MHz Xtal
    By ozzie1st in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 26th July 2007, 23:01
  5. Clock connection to DS1802 from 16F877A
    By coyotegd in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd January 2006, 18:52

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