The PIC16F818/819 devices include an internal
oscillator block which generates two different clock
signals; either can be used as the system’s clock
source. This can eliminate the need for external
oscillator circuits on the OSC1 and/or OSC2 pins.
The main output (INTOSC) is an 8 MHz clock source
which can be used to directly drive the system clock. It
also drives the INTOSC postscaler which can provide a
range of clock frequencies from 125 kHz to 4 MHz.
The other clock source is the internal RC oscillator
(INTRC) which provides a 31.25 kHz (32 μs nominal
period) output. The INTRC oscillator is enabled by
selecting the INTRC as the system clock source or
when any of the following are enabled:
• Power-up Timer
• Watchdog Timer
The clock source frequency (INTOSC direct, INTRC
direct or INTOSC postscaler) is selected by configuring
the IRCF bits of the OSCCON register.
The OSCCON register (Register 4-2) controls several
aspects of the system clock’s operation.
The Internal Oscillator Select bits, IRCF2:IRCF0, select
the frequency output of the internal oscillator block that
is used to drive the system clock. The choices are the
INTRC source (31.25 kHz), the INTOSC source
(8 MHz) or one of the six frequencies derived from the
INTOSC postscaler (125 kHz to 4 MHz). Changing the
configuration of these bits has an immediate change on
the multiplexor’s frequency output.
The first item on the agenda when working with a new IC or MCU is visit the manufactures product page:
Microchip's PIC16F819 Product Page
You'll see according to the features listed, the PIC has an 8 MHz Internal Oscillator.
While you're there grab the PIC's datasheet, an absolute must have, any datasheet errata and yes MCUs have "bugs" too, so grab any silicon errata or peripheral errata.
PIC16F818/819 Datasheet
Reviewing any errata can greatly reduce stress levels and aspirin intake during the development process.
The datasheet for the particular MCU series you're working with is its bible, read it, study it, know it.
Datasheet information concerning internal oscillator frequency configuration:
Check the datasheet for further details for internal oscillator configuration.
Also take a look at any appnotes listed, they usually pertain to that specific MCU series and can give valuable info, tips and shortcuts to implementing your design.
Hope these guidelines and info help in your endeavors.
bit 7 Unimplemented: Read as ‘0’
bit 6-4 IRCF2:IRCF0: Internal Oscillator Frequency Select bits
111 = 8 MHz (8 MHz source drives clock directly)
110 = 4 MHz
101 = 2 MHz
100 = 1 MHz
011 = 500 kHz
010 = 250 kHz
001 = 125 kHz
000 = 31.25 kHz (INTRC source drives clock directly)
bit 3 Unimplemented: Read as ‘0’
bit 2 IOFS: INTOSC Frequency Stable bit
1 = Frequency is stable
0 = Frequency is not stable
bit 1-0 Unimplemented: Read as ‘0’
banksel OSCCON
movlw B'01110000'
movwf OSCCON
I have tested the intstruction you have given above and discoverd that the default frequency is 31.25 KHz.
banksel OSCCON
movlw B'01110000' ; 8MHz Internal Oscillator Frequency Select bits
movwf OSCCON
The internal oscillator is Resistance Capacitor.
How much precise it is?
what is mean by stable and not stable frequency pleaseeee?
If the INTRC (31.25 kHz, IRCF<2:0> = 000) is running and the IRCF bits are modified to any other value than ‘000’, a 4 ms (approx.) clock switch delay is turned on. Code execution continues at a higher than expected frequency while the new frequency stabilizes. Time sensitive code should wait for the IOFS bit in the OSCCON register to become set before continuing. This bit can be monitored to ensure that the frequency is stable before using the system clock in time critical applications.
Thank you sooo muchhhhhhhh
YA another question
__CONFIG _CP_OFF & _WRT_ENABLE_OFF & _CPD_OFF & _CCP1_RB2 & _LVP_OFF & _BODEN_ON & _MCLR_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_IO
can i change this in some way to select 8mhz in __config file?????????
whats about this code to check stable frequency before proceed if i change the frequency in my code for counting or some other purposes and than switch back to 8mhz
processor PIC16F819
#include <p16f819.inc>
__CONFIG _CP_OFF & _WRT_ENABLE_OFF & _CPD_OFF & _CCP1_RB2 & _LVP_OFF & _BODEN_ON & _MCLR_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_IO
J equ 20h
org 0
goto main
main:
banksel OSCCON
movlw B'01110000'
movwf OSCCON
stable: btfss OSCCON , 2
goto stable
banksel PORTB
clrf PORTB
banksel TRISB
movlw B'00000000'
movwf TRISB
************stable: btfss OSCCON , 2
goto stable
--------------------------------------------------------------------------------
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?