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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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 ?
OR am I completely wrong and I'm missing something that is going to make me look silly ?
Last edit: rowdy 2019-05-21
Yes, this PIC does not have an internal oscillator, you need to connect an external one.