SN8P2740 Series
ADC, OP-amp, Comparator 8-Bit Micro-Controller
10.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
10.6 COMPARATOR 1 OPERATION EXPLAME
COMPARATOR 1 CONFIGURATION:
; Reset Comparator 1.
CLR
CM1M
; Clear CM1M register.
; Set Comparator 1 positive terminal.
MOV
B0MOV
A, #00000nnnb
CM1M, A
; Set CM1RS[2:0] for comparator positive terminal.
; Set Comparator 1 function mode.
B0BCLR
FCM1SF
; Normal comparator mode.
; Special function mode.
; or
B0BSET
FCM1SF
; Set Comparator 1 output pin.
B0BCLR
FCM1OEN
FCM1OEN
; Disable comparator 1 output pin.
; Enable comparator 1 output pin.
; or
B0BSET
; Set Comparator 1 interrupt trigger edge.
B0BCLR
FCM1G
; Falling edge.
; Rising edge.
; or
B0BSET
FCM1G
; Set Comparator 1 output de-bounce.
B0MOV
AND
OR
A, CMDB0
; Set CM1D[3:0] for comparator output de-bounce.
A, #00001111b
A, #nnnn0000b
CMDB0, A
B0MOV
; Clear CM1IRQ
B0BCLR
FCM1IRQ
; Enable Comparator 1 and interrupt function.
B0BSET
B0BSET
FCM1IEN
FCM1EN
; Enable Comparator 1 interrupt function.
; Enable Comparator 1.
SONiX TECHNOLOGY CO., LTD
Page 100
Version 2.0