SN8P2318 Series
C-type LCD, RFC 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 88
Version 1.5
TC0 EVENT COUNTER CONFIGURATION:
; Reset TC0 timer.
CLR
TC0M
; Clear TC0M register.
; Enable TC0 event counter.
B0BSET
FTC0CKS1
; Set TC0 clock source from external input pin (P0.0).
; Set TC0C and TC0R register for TC0 Interval time.
MOV
A, #
value
; TC0C must be equal to TC0R.
B0MOV
TC0C, A
B0MOV
TC0R, A
; Clear TC0IRQ
B0BCLR
FTC0IRQ
; Enable TC0 timer and interrupt function.
B0BSET
FTC0IEN
; Enable TC0 interrupt function.
B0BSET
FTC0ENB
; Enable TC0 timer.
TC0 PWM CONFIGURATION:
; Reset TC0 timer.
CLR
TC0M
; Clear TC0M register.
; Set TC0 clock source and TC0 rate.
MOV
A, #0
nnn
0
n
00b
B0MOV
TC0M, A
; Set TC0C and TC0R register for PWM cycle.
MOV
A, #
value1
; TC0C must be equal to TC0R.
B0MOV
TC0C, A
B0MOV
TC0R, A
; Set TC0D register for PWM duty.
MOV
A, #
value2
; TC0D must be greater than TC0R.
B0MOV
TC0D, A
; Enable PWM and TC0 timer.
B0BSET
FTC0ENB
; Enable TC0 timer.
B0BSET
FPWM0OUT
; Enable PWM.