SN8P2501D
8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 81
Version 1.5
TC0 BUZZER OUTPUT CONFIGURATION:
; Reset TC0 timer.
MOV
A, #0x00
; Clear TC0M register.
B0MOV
TC0M, A
; Set TC0 rate and auto-reload function.
MOV
A, #0
nnn
0000b
; TC0rate[2:0] bits.
B0MOV
TC0M, A
B0BSET
FALOAD0
; Set TC0C and TC0R register for TC0 Interval time.
MOV
A, #
value
; TC0C must be equal to TC0R.
B0MOV
TC0C, A
B0MOV
TC0R, A
; Enable TC0 timer and buzzer output function.
B0BSET
FTC0ENB
; Enable TC0 timer.
B0BSET
FTC0OUT
; Enable TC0 buzzer output function.
TC0 PWM CONFIGURATION:
; Reset TC0 timer.
MOV
A, #0x00
; Clear TC0M register.
B0MOV
TC0M, A
; Set TC0 rate for PWM cycle.
MOV
A, #0
nnn
0000b
; TC0rate[2:0] bits.
B0MOV
TC0M, A
; Set PWM resolution.
MOV
A, #00000
nn
0b
; ALOAD0 and TC0OUT bits.
OR
TC0M, A
; Set TC0R register for PWM duty.
MOV
A, #
value
B0MOV
TC0R, A
; Clear TC0C as initial value.
CLR
TC0C
; Enable PWM and TC0 timer.
B0BSET
FTC0ENB
; Enable TC0 timer.
B0BSET
FPWM0OUT
; Enable PWM.