The clock oscillating circuit for PIC to operate is built in PIC16F628.It can use in the case where highly precise operation is unnecessary or to reduce the number of use parts.
There are four kinds of oscillation compositions. They are the type which uses an outside oscillation element, the type which supplies a clock from outside, the type which uses a fixation frequency oscillator(4MHz) inside and the type which adjusts the frequency of the inner oscillation circuit with the resistor. These types are designated by FOSC2-0 bits of Configuration Word.
The kind of the oscillator which depends on FOSC2-0 bits of Configuration Word
FOSC2-0 | Contents |
111 |
ER(External Resistor) oscillator:
CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor on RA7/OSC1/CLKIN |
110 |
ER(External Resistor) oscillator:
I/O function on RA6/OSC2/CLKOUT pin, Resistor on RA7/OSC1/CLKIN |
101 |
INTRC(Internal 4MHz OSC) oscillator:
CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN |
100 |
INTRC(Internal 4MHz OSC) oscillator:
I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN |
011 |
EC(External Clock In):
I/O function on RA6/OSC2/CLKOUT pin, CLKIN on RA7/OSC1/CLKIN |
010 | HS oscillator: High speed crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN |
001 | XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN |
000 | LP oscillator: Low power crystal on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN |
The type which uses an outside oscillation element (FOSC2-0 : 000/001/010)
This type is the circuit generally used.
A crystal oscillation element is used for Xtal. Moreover, Resonator which built in the ceramic oscillation element and the capacitors is used.
I use resonator often.
The type which supplies a clock from outside (FOSC2-0 : 011)
This type is the type which uses the output of the outside oscillator as the clock of PIC.
RA6/OSC2/CLKOUT( pin15 ) can be used as the I/O port.
The type which uses the inner oscillation circuit (FOSC2-0 : 100/101)
The oscillation frequency is fixed on 4MHz but is convenient when wanting to use RA6/RA7 as the I/O port.
The type which adjusts the frequency of the inner oscillation circuit with the resistor (FOSC2-0 : 110/111)
In case of this type, OSC1 port is used to connect a resistor for the oscillation frequency adjustment. So, RA7 can't be use as the I/O port.
Relation between the resistance value and the oscillation frequency is shown below.
Resistance | Frequency |
0 | 10.4MHz |
1K | 10.0MHz |
10K | 7.4MHz |
|
Resistance | Frequency |
20K | 5.3MHz |
47K | 3MHz |
100K | 1.6MHz |
|
Resistance | Frequency |
220K | 800kHz |
470K | 300kHz |
1M | 200kHz |
|
|