
M37221M4H/M6H/M8H/MAH–XXXSP/FP M37221EASP/FP
Rev.1.00 Oct 01, 2002 page 49 of 110
REJ03B0134-0100Z
8.8 A-D COMPARATOR
A-D comparator consists of a 6-bit D-A converter and a comparator.
The A-D comparator block diagram is shown in Figure 8.8.1.
The reference voltage “Vref” for D-A conversion is set by bits 0 to 5 of
the A-D control register 2 (address 00EF16).
The comparison result of the analog input voltage and the reference
voltage “Vref” is stored in bit 4 of the A-D control register 1 (address
00EE16).
For A-D comparison, set “0” to corresponding bits of the direction
register to use ports as analog input pins. Write the data to select
analog input pins for bits 0 to 2 of the A-D control register 1 and write
the digital value corresponding to Vref to be compared to bits 0
to 5 of the A-D control register 2. The voltage comparison is started
by writing to the A-D control register 2, and it is completed after 16
machine cycles (NOP instruction ✕ 8).
Fig. 8.8.1 A-D Comparator Block Diagram
-
contro
reg
ster 1
Bits 0 to 2
C
o
m
p
a
r
a
t
o
r
c
o
n
t
r
o
l
D
a
t
a
b
u
s
Bit 4
Switch tree
A-D control
register 2
R
e
s
i
s
t
o
r
l
a
d
d
e
r
C
o
m
p
a
-
r
a
t
o
r
A
n
a
l
o
g
s
i
g
n
a
l
s
w
i
t
c
h
B
i
t
5B
i
t
4B
i
t
3Bit 2Bit 1Bit 0
A
-
D
c
o
n
t
r
o
l
r
e
g
i
s
t
e
r
1
-
1
-
2
-
3
-
4
-
5
-
6
Commenti su questo manuale