When the External Crystal/Resonator is selected as the system clock on the PIC® MCU device the crystal or resonator drive circuit requires time to settle before reliable code execution can occur. For this reason, the Oscillator Start-up Timer (OST) is used to give the drive circuitry time to settle. The OST counts 1024 oscillations from the crystal/resonator drive circuit at the OSC1 pin. The count begins after a Power On Reset (POR) and if enabled, the Power-Up Reset Timer (PWRT) has expired. The OST ensures that the crystal oscillator or the ceramic resonator have started and can provide a stable system clock.
During the 1024 oscillations the device is held in reset, the program counter does not increment and program execution is suspended. During this OST delay of 1024 oscillations, the system clock can be suplied by the Internal Oscillator if the Fail Safe Clock Monitor or Two Speed Start-Up is enabled.
Oscillator Start-up Timer Status Bit
The Oscillator Start-up Timer Status (OSTS) bit in the Oscillator Status (OSCSTAT) register indicates when the internal 1024 oscillations has been completed by setting the OSTS bit to a one. When the OSTS = 1 then the External Crystal/Resonator is the system clock controlling the program counter and program execution. This bit will be set to zero during the 1024 oscillations to indicate the External Crystal/Resonator is not ready.
For more information on 8-Bit oscillator options visit the 8-Bit Oscillator Options article.