Menu

Help please with oscillator config in 16f877a

Help
rowdy
2019-05-21
2019-05-21
  • rowdy

    rowdy - 2019-05-21

    Hello all.
    I'm asking for some help please with a 16f877a.

    I have had good results with many other pics but I cannot get any of the sample codes to work on a 16f877a.
    The problem seems to be with setting the internal oscillator.
    There are a lot of sample codes in GCB for 16f877a,
    Here is one example code for TONE.

    #chip 16F877A, 20
    #define SoundOut PORTB.1
    
    Do
        Tone 440, 1000
    Loop
    

    The #chip line seems to be saying set the internal oscillator to 20 megs.

    The above code compiles and the hex programs the 16f877a, but fails to work.

    I have had a look at the latest GCB chip data file for the 16f877a and it says IntOsc=0

    From the chip data I have come to the conclusion that the only way this chip can work is with external oscillator parts , for example a crystal.

    If I am right, what is the CORRECT way in GCGB to set the pic to an external crystal oscillator ?
    Something like this for a 10 meg crystal ?

    #chip 16F877A,10
    #config OSC=HS
    

    OR am I completely wrong and I'm missing something that is going to make me look silly ?

     

    Last edit: rowdy 2019-05-21
  • Trev

    Trev - 2019-05-21

    Yes, this PIC does not have an internal oscillator, you need to connect an external one.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.