M37221M4H/M6H/M8H/MAH–XXXSP/FP M37221EASP/FP
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).
Data bus
A-D control register 1
Comparator control
Bits 0 to 2
A-D control
register 1
A-D control
register 2
A-D1
A-D2
A-D3
A-D4
A-D5
A-D6
Analog
signal
switch
Compa-
rator
Bit 4 Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Switch tree
Resistor ladder
Fig. 8.8.1 A-D Comparator Block Diagram
Rev.1.00 Oct 01, 2002 page 49 of 110
REJ03B0134-0100Z