8-bit PIC® MCU Timer1 Secondary Oscillator

Last modified by Microchip on 2023/11/22 16:33

A dedicated low-power 32.768 kHz oscillator circuit is built-in between pins SOSCI (input) and SOSCO (amplifier output). This internal circuit requires an external 32.768 kHz "clock" crystal to operate. This oscillator is designed as a clock source to feed the Timer 1 module and enable the PIC® microcontroller (MCU) device to create timekeeping applications. The oscillator can also be used as a secondary system clock when Clock Switching is enabled.

One advantage to this clock source is the oscillator will continue to run during Sleep mode so the timekeeping can continue to operate at low power.

8-bit PIC MCU Timer1 diagram

Enabling Timer1 Secondary Oscillator

Setting the Oscillator Enable Control (T1OSCEN) bit in the Timer1 Control (T1CON) register will enable the oscillator drive circuitry.

Timer1 Control Register

Timer1 Control Register

Oscillator Start-up Delay

The oscillator requires a start-up and stabilization time before use. Thus, the T1OSCEN bit should be set and a suitable delay similar to the Oscillator Start-up Timer (OST) delay can be implemented in software by clearing the Timer1 Interrupt Flag (TMR1IF) bit in the Peripheral Interrupt Register (PIR) and then presetting the Timer1 High (TMR1H) and Timer1 Low (TMR1L) register pair to a hexadecimal value of FC00. The TMR1IF flag will be set when 1024 clock cycles have elapsed, thereby indicating that the oscillator is running and reasonably stable.

Learn More