SN8P2977
8-Bit Micro-Controller with Regulator, PGIA, 24-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 81
Version 1.7
8.3.6
TC0 CLOCK FREQUENCY OUTPUT (BUZZER)
Buzzer output (TC0OUT) is from TC0 timer/counter frequency output function. By setting the TC0 clock frequency, the
clock signal is output to P1.1 and the P1.1 general purpose I/O function is auto-disable. The TC0OUT frequency is
divided by 2 from TC0 interval time. TC0OUT frequency is 1/2 TC0 frequency. The TC0 clock has many combinations
and easily to make difference frequency. The TC0OUT frequency waveform is as following.
1
2
3
4
1
2
3
4
TC0 Overflow Clock
TC0OUT (Buzzer) Output Clock
Example: Setup TC0OUT output from TC0 to TC0OUT (P1.1). The external high-speed clock is 8MHz.
(Fcpu=Fosc/8) The TC0OUT frequency is 0.5KHz. Because the TC0OUT signal is divided by 2, set the TC0
clock to 1KHz. The TC0 clock source is from external oscillator clock. T0C rate is Fcpu/4. The
TC0RATE2~TC0RATE1 = 110. TC0C = TC0R = 6.
MOV
A,#01100000B
B0MOV
TC0M,A
; Set the TC0 rate to Fcpu/4
MOV
A,#6
; Set the auto-reload reference value
B0MOV
TC0C,A
B0MOV
TC0R,A
B0BSET
FTC0OUT
; Enable TC0 output to P1.1 and disable P1.1 I/O function
B0BSET
FALOAD0
; Enable TC0 auto-reload function
B0BSET
FTC0ENB
; Enable TC0 timer
4.
Note: Buzzer output is enable, and
“PWM0OUT” must be “0”.