Timer1 Clock Source

The Timer1 Clock Source is the input signal that increments the Timer1 counter. The clock source is selected by the Timer1 Clock Select (TMR1CS<1:0>) bits in the T1CON register.


There are four clock selections which include:


Note: On older devices, there are only three clock source options as the fourth optional selection is not included. On those devices, the TMR1CS is a single bit in the T1CON register.

Fosc/4 Instruction Clock Source (00)

When the instruction clock (Fosc/4) is selected (TMR1CS <1:0> = 00), Timer1 is incremented by the system oscillator through a divide by four scalers (Fosc/4). The TMR1H:TMR1L register pair will be incremented on the rising edge of the instruction clock. Any reads of the TMR1H:TMR1L registers are done based on this Fosc/4 instruction clock.

Fosc System Clock Source (01)

The Fosc is the system oscillator. When the Fosc system clock is selected (TMR1CS <1:0> = 01) as the Timer1 Clock Source, Timer1 is incremented by the system oscillator clock directly. The TMR1H:TMR1L register pair will be incremented on the rising edge of the oscillator clock. One thing to recognize is that any reads of the TMR1H:TMR1L registers are done based on the instruction clock (Fosc/4), even when the Fosc is selected as the Timer1 clock. When the Fosc internal clock source is selected, the Timer1 register value will increment by four counts for every instruction clock cycle. Due to this condition, a 2 LSB error in resolution will occur when reading the Timer1 value.

External Clock Source (10)

When the external clock is selected (TMR1CS<1:0> = 10*), the Timer1 Oscillator Enable (T1OSCEN) bit selects the external signal source. The Timer1 module may work as a counter using an I/O pin as the input source, or a timer using an external 32 kHz clock oscillator.


When a counter is desired, the T1CKI input is selected by the Timer1 Oscillator Enable (T1OSCEN) bit. Timer1 is incremented on the rising edge of the external clock input signal at the T1CKI pin, which can be synchronized to the microcontroller system clock or can run asynchronously.

External 32 kHz Clock Oscillator

When a timer with a separate clock oscillator is desired, the T1OSCEN bit is set to the crystal oscillator mode. When this mode is selected, the Timer1 structure will also enable a dedicated low-power 32.768 kHz oscillator drive circuit built internally between I/O pins SOSCI (input) and SOSCO (amplifier output). This internal circuit is to be used in conjunction with an external 32.768 kHz "clock crystal". This can enable Timer1 to act as a dedicated real-time clock. The oscillator will continue to run during Sleep. More details on this option can be found at: Timer1 Secondary Oscillator.


Timer1 Asynchronous Mode

When the External Clock mode is selected as the Timer1 source, it can run asynchronously to the system clock. The Timer1 External Clock Input Synchronization Control bit (T1SYNC) of the T1CON register can be set to make the external clock un-synchronized. The timer will then increment asynchronously to the internal phase clocks. Running asynchronously allows the external clock source to continue incrementing the timer during Sleep and can generate an interrupt on overflow. The interrupt will wake up the processor so an internal time-based application can be updated. However, special precautions in software are needed to read/write the timer.


Reading and Writing to Timer1 in Asynchronous Counter Mode

Reading the TMR1H or TMR1L registers while Timer1 is running from an external asynchronous clock will return a valid read value as it is taken care of in hardware. For writes, it is recommended that you simply stop the timer and write the desired values for accurate implementation.

Optional Fourth Clock (11)

Low-Frequency Internal Oscillator

On some devices, Timer1 can be incremented separately by the Low-Frequency Internal Oscillator. This will allow Timer1 to increment independently of the system or instruction clock.

Capacitive Sensing Oscillator

On some devices, the capacitive sensing oscillator, which consists of a constant current source and a constant current sink to produce a triangle waveform, can be used as the oscillator designed to drive a capacitive load (single PCB pad). This clock source can also be shared to be the clock source to Timer1.

© 2019 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.