TOP

What is the clock source of Sonix MCU Timer/counter? How to set the timer frequency divider?

Timer / Counter TC0 has dual clock source, user can select internal clock or external clock as timer clock source. Among which the internal clock is from Fcpu, external clock is from the P0.0 pin INT0 input (falling edge trigger). Normally, there are 8 choices for timer frequency, users can set the timer / counter frequency (2 ~ 256 frequency) by T0rate0 ~ T0rate2/TCnrate0 ~ TCnrate2 bit of T0M/TCnM register, the number of frequency settings can refer to datasheet. 
For example: 
MOV A,#01100000B 
B0MOV TC0M,A ; TC0 Rate=Fcpu/4。
For those microcontrollers with TC0X8/TC1X8 bit, you can select external oscillator frequency (Fosc) or the system clock (Fcpu) as timer count frequency signals. At this time, the number of frequency is 1 ~ 128.