SN8P2318 Series
C-type LCD, RFC 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 101
Version 1.5
9.5 RFC OPERATION EXAMPLE
Example: Measure RFC signal through T1 event counter function.
; Set T1 timer mode.
CLR
T1M
; T1 clock is Fcpu and rate is Fcpu/128.
MOV
A, #0
; Clear T1 counter buffers.
B0MOV
T1CH, A
B0MOV
T1CL, A
; Set T1 event counter mode.
MOV
A, #10001000B
; Configure and enable T1 capture timer.
B0MOV
T1CKSM, A
MOV
A, #0
; Set T1 event counter buffers.
B0MOV
T1VCH, A
MOV
A, #0xFF
B0MOV
T1VCL, A
B0BCLR
FT1IRQ
; Clear T1 interrupt request flag.
; Set RFC.
CLR
P1UR
; Disable P1 pull-up resistor.
MOV
A, #11100000B
AND
P1M, A
; Set P1.0~P1.4 to input mode.
MOV
A, #10010000B
; Enable RFC and select RFC channel 0.
B0MOV
RFCM, A
B0BSET
FT1ENB
; Enable T1 timer.
B0BSET
FCPTStart
; Start to measure RFC frequency.
; Check T1IRQ=1.
Chk_T1IRQ:
B0BTS1
FT1IRQ
; Check T1IRQ=1.
JMP
Chk_T1IRQ
B0MOV
A, T1CL
; The end of RFC measurement.
…
B0MOV
A, T1CH
…