The Two-Speed Clock Start-up provides an automatic Clock Switch feature that will initially run the device from the INTOSC Internal Oscillator when the main system clock is set to the External Crystal Oscillator mode. This feature is available on most newer devices.
The advantage to this feature is a quicker start-up for the PIC® MCU device. This is because the external crystal oscillator drive circuitry requires 1024 oscillations to stabilize before it is ready for normal operation. The device will be held in reset during this stabilization period (if Two-Speed Start-up is not enabled). This can cause unwanted delays at start-up or after the device returns from sleep mode. The Two-Speed Clock Start-up, when enabled, will run the device from the INTOSC clock during the 1024 oscillation delay and therefore the device will start operating quicker.
The Two-Speed Start-up will activate after a device completes a Power On Reset or a wake from sleep mode.
Note: If the Power-up Timer is enabled, the Two-Speed Start-up will wait until this timer completes its delay.
The Oscillator Start-up Timer Status (OSTS) bit in the OSCCON register will be set to a one when the 1024 oscillations have been completed. The 1024 oscillation completion will also initiate the switch from the INTOSC to the Fosc selected clock source.
Two-Speed Clock Start-up Configuration
The Two-Speed Clock Start-up requires a few settings to enable the operation. These are set in a configuration register when the device is programmed with the application code.
IESO bit
The Internal External Switchover (IESO) bit needs to be set to one to enable the Two-Speed Clock Start-up.
Fosc bits
The External Crystal Oscillator selection for LP, XT or HS must also be selected with the Fosc bits for the Two-Speed Clock Start-up to be enabled.
SCS bits
The SCS bits of the OSCCON register need to be set to: 00 for the Two-Speed Clock Start-up to be enabled. These can be set in software but the default mode is: 00 after a reset. If these are changed for any reason in the application code, then they must be set back to: 00 prior to entering sleep mode for Two-Speed Start-up to be enabled.
For more information on 8-Bit oscillator options visit the 8-Bit Oscillator Options article.