Timer 0 Timer Mode

Last modified by Microchip on 2023/11/09 09:03

The Timer0 module can be used as an 8-bit timer. In Timer mode, it is incremented on every instruction clock pulse unless a prescaler is used to reduce the speed. The TMR0 register can be written via software to preload it with a value. If the TMR0 register is written, the increment is inhibited for the following two instruction cycles. This can be adjusted in the prewritten value.

Timer Mode

Timer mode is selected by clearing the TMR0CS bit of the OPTION_REG register.

TMR0 clock

Software Programmable Prescaler

A software programmable prescaler is available for exclusive use with Timer0. The prescaler is enabled by clearing the PSA bit of the OPTION_REG register. There are eight prescaler options for the Timer0 module ranging from 1:2 to 1:256. The prescale values are selectable via the PS<2:0> bits of the OPTION_REG register. In order to have a 1:1 prescaler value for the Timer0 module, the prescaler must be disabled by setting the PSA bit of the OPTION_REG register.


Prescaler rate select bits

The prescaler is not readable or writable. All instructions written to the TMR0 register will clear the prescaler. The prescaler is exclusively shared between the Timer0 module and the Watchdog Timer. When the prescaler is assigned to the Timer0 module, any write to the TMR0 register will immediately update the TMR0 register and clear the prescaler.