SN8P1700
8-bit micro-controller build-in 12-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 122
Revision 1.93
TC0 CLOCK FREQUENCY OUTPUT (BUZZER)
TC0 timer counter provides a frequency output function. By setting the TC0 clock frequency, the clock signal is output
to P5.4 and the P5.4 general purpose I/O function is auto-disable. The TC0 output signal divides by 2. The TC0 clock
has many combinations and easily to make difference frequency. This function applies as buzzer output to output
multi-frequency.
Figure 7-5. The TC0OUT Pulse Frequency
Example: Setup TC0OUT output from TC0 to TC0OUT (P5.4). The external high-speed clock is 4MHz. The
TC0OUT frequency is 1KHz. Because the TC0OUT signal is divided by 2, set the TC0 clock to
2KHz. The TC0 clock source is from external oscillator clock. T0C rate is Fcpu/4. The
TC0RATE2~TC0RATE1 = 110. TC0C = TC0R = 131.
MOV
A,#01100000B
B0MOV
TC0M,A
; Set the TC0 rate to Fcpu/4
MOV
A,#131
; Set the auto-reload reference value
B0MOV
TC0C,A
B0MOV
TC0R,A
B0BSET
FTC0OUT
; Enable TC0 output to P5.4 and disable P5.4 I/O function
B0BSET
FALOAD0
; Enable TC0 auto-reload function
B0BSET
FTC0ENB
; Enable TC0 timer