SN8P2740 Series
ADC, OP-amp, Comparator 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 94
Version 2.0
9.6 COMPARATOR 0 OPERATION EXPLAME
COMPARATOR 0 CONFIGURATION:
; Reset Comparator 0.
CLR
CM0M
; Clear CM0M register.
; Set Comparator 0 function mode.
B0BCLR
FCM0SF
; Normal comparator mode.
; or
B0BSET
FCM0SF
; Special function mode.
; Set Comparator 0 output pin.
B0BCLR
FCM0OEN
; Disable comparator 0 output pin.
; or
B0BSET
FCM0OEN
; Enable comparator 0 output pin.
; Set Comparator 0 interrupt trigger edge.
B0BCLR
FCM0G
; Falling edge.
; or
B0BSET
FCM0G
; Rising edge.
; Set Comparator 0 output de-bounce.
B0MOV
A, CMDB0
; Set CM0D[3:0] for comparator output de-bounce.
AND
A, #1111
0000
b
OR
A, #0000
nnnn
b
B0MOV
CMDB0, A
; Clear CM0IRQ
B0BCLR
FCM0IRQ
; Enable Comparator 0 and interrupt function.
B0BSET
FCM0IEN
; Enable Comparator 0 interrupt function.
B0BSET
FCM0EN
; Enable Comparator 0.