SN8P2501D
8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 77
Version 1.5
8.3.6 TC0 EVENT COUNTER
TC0 event counter is set the TC0 clock source from external input pin (P0.0). When TC0CKS1=1, TC0 clock source is
switch to external input pin (P0.0). TC0 event counter trigger direction is falling edge. When one falling edge occurs,
TC0C will up one count. When TC0C counts from 0xFF to 0x00, TC0 triggers overflow event. The external event
counter input pin’s wake-up function of GPIO mode is disabled when TC0 event counter function enabled to avoid
event counter signal trigger system wake-up and not keep in power saving mode. The external event counter input
pin’s external interrupt function is also disabled when TC0 event counter function enabled, and the P00IRQ bit keeps
“0” status. The event counter usually is used to measure external continuous signal rate, e.g. continuous pulse, R/C
type oscillating signal
…These signal phase don’t synchronize with MCU’s main clock. Use TC0 event to measure it
and calculate the signal rate in program for different applications.
0x00
or TC0R
...
...
External Input Signel
TC0C
TC0IRQ
TC0 timer overflows. TC0IRQ set as “1”.
Reload TC0C from TC0R automatically.
TC0IRQ is cleared by program.
0x01
0x02
0x03
0xFE
0xFF
TC0R
...
...
8.3.7 TC0 BUZZER OUTPUT
The buzzer output is a simple 1/2 duty signal output function. The buzzer signal is generated from TC0 timer. When
TC0 timer overflows, the buzzer output exchanges status, and generates a square waveform. The frequency of buzzer
output is 1/2 of TC0 interval time. The TC0 clock has many combinations and easily to make difference frequency. The
buzzer output waveform is as following.
0xFF
...
Buzzer Output
TC0C
TC0IRQ
TC0 timer overflows. TC0IRQ set as “1”.
Reload TC0C from TC0R automatically.
TC0IRQ is cleared by program.
0x00
TC0R
...
...
0xFF
0x00
TC0R
...
0xFF
0x00
TC0R
...
...
...
TC0 Timer Interval Time
TC0 Buzzer Output Rate