SN8P2740 Series
ADC, OP-amp, Comparator 8-Bit Micro-Controller
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.
Comparator
Output
CMnO
Comparator
Negative Input
CMnN
CMnP
0.1uF
0.1uF
MCU
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
B0MOV
A, #00000nnnb
CM2M, A
; Set CM2RS[2:0] for comparator positive terminal.
; Set Comparator 2 function mode.
B0BCLR
FCM2SF
; Normal comparator mode.
; Special function mode.
; or
B0BSET
FCM2SF
; Set Comparator 2 output pin.
B0BCLR
FCM2OEN
FCM2OEN
; Disable comparator 2 output pin.
; Enable comparator 2 output pin.
; or
B0BSET
; Set Comparator 2 interrupt trigger edge.
B0BCLR
FCM2G
; Falling edge.
; Rising edge.
; or
B0BSET
FCM2G
; Set Comparator 2 output de-bounce.
MOV
A, #0000nnnnb
; Set CM2D[3:0] for comparator output de-bounce.
B0MOV
CMDB1, A
; Clear CM2IRQ
B0BCLR
FCM2IRQ
; Enable Comparator 2 and interrupt function.
B0BSET
B0BSET
FCM2IEN
FCM2EN
; Enable Comparator 2 interrupt function.
; Enable Comparator 2.
SONiX TECHNOLOGY CO., LTD
Page 106
Version 2.0