This technique compares device clock speed to some reference clock. Two timers may be used to faciliate the process of Extract Microcontroller PIC16F1903 Embedded Firmware; one timer is clocked by the peripheral clock, while the other is clocked by a fixed reference source, such as the Timer1 oscillator.
Both timers are cleared, but the timer clocked by the reference generates interrupts. When an interrupt occurs, the internally clocked timer is read and both timers are cleared. If the internally clocked timer value is greater than expected, then the internal oscillator block is running too fast. To adjust for this, decrement the OSCTUNE register.
Like previous PIC16Fxxxx devices, the PIC16F1903 family includes a feature that allows the device clock source to be switched from the main oscillator to an alternate low-frequency clock source. PIC16F1903 devices offer two alternate clock sources. When an alternate clock source is enabled, the various power-managed operating modes are available.
Essentially, there are three clock sources for these devices:
- Primary oscillators
- Secondary oscillators
- Internal oscillator block
The primary oscillators include the External Crystal and Resonator modes, the External RC modes, the External Clock modes and the internal oscillator block. The particular mode is defined by the FOSC3:FOSC0 Configuration bits when Read Out Heximal from MCU PIC16LF876.
The secondary oscillators are those external sources not connected to the OSC1 or OSC2 pins. These sources may continue to operate even after the controller is placed in a power-managed mode. PIC16F1903 devices offer the Timer1 oscillator as a secondary oscillator. This oscillator, in all power-managed modes, is often the time base for functions such as a real-time clock.