SN8P2740 Series
ADC, OP-amp, Comparator 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 103
Version 2.0
Comparator supports interrupt function. The interrupt trigger condition can be selected through CM2G bit including
rising edge and falling edge. If CM2G = 0, comparator output trigger edge is falling edge. If CM2G = 1, comparator
output trigger edge is rising edge. The edge detection is from comparator output signal through delay processor. When
comparator output edge event occurs and equal CM2G condition, CM2IRQ flag is issued. If CM2IEN = 1, program
counter points to interrupt vector to execute interrupt service routine.
CM2OUT
CM2IRQ, CM2G=0 falling edge
CM2IRQ, CM2G=1 rising edge
CM2IRQ sets as falling edge.
CM2IRQ sets as falling edge.
CM2IRQ sets as rising edge.
CM2IRQ sets as rising edge.
*. CM2IRQ is cleared by program.
Comparator 2
compares positive terminal‟s voltage and negative terminal‟s voltage, and then output result to output pin.
When V+ > V-, comparator outputs high status. When V+ < V-, comparator outputs low status. Comparator output
terminal builds in delay control block to achieve output hysteresis to filter output transition condition. The delay option
has 16-step including no delay, 2/Fcpu, 4/Fcpu, 6/Fcpu, 8/Fcpu, 10/Fcpu, 14/Fcpu, 16/Fcpu, 18/Fcpu, 20/Fcpu,
22/Fcpu, 24/Fcpu, 26/Fcpu, 28/Fcpu, 30/Fcpu controlled by CM2D[3:0] bits.
CM2D[2:0]
0000b
0001b
0010b
0011b
0100b
0101b
0110b
0111b
No
2/Fcpu
4/Fcpu
6/Fcpu
8/Fcpu
10/Fcpu 12/Fcpu 14/Fcpu
Delay time (us)
Fcpu=Fhosc/4
=16MHz/4=4MHz
0
0.5
1
1.5
2
2.5
3
3.5
Delay time (us)
Fcpu=Fhosc/16
=16MHz/16=1MHz
0
2
4
6
8
10
12
14
CM2D[2:0]
1000b
1001b
1010b
1011b
1100b
1101b
1110b
1111b
16/Fcpu 18/Fcpu 20/Fcpu 22/Fcpu 24/Fcpu 26/Fcpu 28/Fcpu 30/Fcpu
Delay time (us)
Fcpu=Fhosc/4
=16MHz/4=4MHz
4
4.5
5
5.5
6
6.5
7
7.5
Delay time (us)
Fcpu=Fhosc/16
=16MHz/16=1MHz
16
18
20
22
24
26
28
30
CM2P
CM2N
CM2OUT without delay.
CM2OUT with delay.
The delay time is controlled by CM2D[3:0] bits.