SN8P2740 Series
ADC, OP-amp, Comparator 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 106
Version 2.0
11.5 COMPARATOR APPLICATION NOTICE
The comparator is to compares the positive voltage and negative voltage to output result. The positive and negative
sources are analog signal. In hardware application circuit, the comparator input pins must be connected a 0.1uF
comparator to reduce power noise and make the input signal more stable. The application circuit is as following.
MCU
CMnN
0.1uF
CMnP
0.1uF
CMnO
Comparator
Output
Comparator
Negative Input
Comparator
Positive Input
11.6 COMPARATOR 2 OPERATION EXPLAME
COMPARATOR 2 CONFIGURATION:
; Reset Comparator 2.
CLR
CM2M
; Clear CM2M register.
; Set Comparator 2 positive terminal.
MOV
A, #00000
nnn
b
; Set CM2RS[2:0] for comparator positive terminal.
B0MOV
CM2M, A
; Set Comparator 2 function mode.
B0BCLR
FCM2SF
; Normal comparator mode.
; or
B0BSET
FCM2SF
; Special function mode.
; Set Comparator 2 output pin.
B0BCLR
FCM2OEN
; Disable comparator 2 output pin.
; or
B0BSET
FCM2OEN
; Enable comparator 2 output pin.
; Set Comparator 2 interrupt trigger edge.
B0BCLR
FCM2G
; Falling edge.
; or
B0BSET
FCM2G
; Rising edge.
; Set Comparator 2 output de-bounce.
MOV
A, #0000
nnnn
b
; Set CM2D[3:0] for comparator output de-bounce.
B0MOV
CMDB1, A
; Clear CM2IRQ
B0BCLR
FCM2IRQ
; Enable Comparator 2 and interrupt function.
B0BSET
FCM2IEN
; Enable Comparator 2 interrupt function.
B0BSET
FCM2EN
; Enable Comparator 2.