![](http://datasheet.mmic.net.cn/280000/M37902F8CHP_datasheet_16084061/M37902F8CHP_79.png)
79
M37902FCCHP, M37902FGCHP, M37902FJCHP
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
MITSUBISHI MICROCOMPUTERS
Operation mode
The operation mode is selected by bits 3 and 4 of A-D control regis-
ter 0. The available operation modes are one-shot, repeat, single
sweep, and repeat sweep. Analog input port pins are multiplexed
with port P7 pins. Therefore, bits which correspond to pins for A-D
conversion must be
“
0
”
(input mode).
(1) One-shot mode
One-shot mode is selected when bits 3 and 4 of A-D control register
0 are
“
0
”
is
“
0
”
. The A-D conversion pins are selected with bits 0 to 2
of A-D control register 0. A-D conversion can be started by a soft-
ware trigger or by an external trigger.
When an internal trigger is selected, A-D conversion is started when
bit 6 (A-D conversion start bit) is set to
“
1.
”
When bit 3 of the A-D control register 1 is
“
1
”
, A-D conversion ends
after 59
φ
AD
cycles, and the interrupt request bit of the A-D interrupt
control register is set to
“
1.
”
At the same time, A-D control register 0
bit 6 (A-D conversion start bit) is cleared to
“
0
”
and A-D conversion
stops. The result of A-D conversion is stored in the A-D register cor-
responding to the selected pin.
If an external trigger is selected, A-D conversion starts when the A-D
conversion start bit is
“
1
”
and a valid edge is input to the AD
TRG
pin,
This operation is the same as that for internal trigger except that
the A-D conversion start bit is not cleared after A-D conversion and
a retrigger can be available during A-D conversion.
(2) Repeat mode
Repeat mode is selected when bit 3 of A-D control register 0 is
“
1
”
and bit 4 is
“
0
”
.
The operation of this mode is the same as the operation of one-shot
mode except that when A-D conversion of the selected pin is com-
plete and the result is stored in the A-D register, conversion does not
stop, but is repeated.
No interrupt request is generated in this mode. Furthermore, if an
external trigger is selected, the A-D conversion start bit is not
cleared.
The contents of the A-D register can be read at any time.
(3) Single sweep mode
Single sweep mode is selected when bit 3 of A-D control register 0 is
“
0
”
and bit 4 is
“
1
”
.
In the single sweep mode, the number of analog input pins to be
swept can be selected. Analog input pins are selected by bits 1 and
0 of the A-D control register 1 (address 1F
16
). Two pins, four pins, six
pins, or eight pins can be selected as analog input pins, depending
on the contents of these bits.
A-D conversion is performed only for selected input pins. After A-D
conversion is performed for input of AN
0
pin, the conversion result is
stored in A-D register 0, and in the same way, A-D conversion is per-
formed for selected pins one after another. After A-D conversion is
performed for all selected pins, the sweep is stopped.
A-D conversion can be started with an internal trigger or with an ex-
ternal trigger input. An internal trigger is selected when bit 5 of the A-
D control register 0 (address 1E
16
) is
“
0
”
and an external trigger is
selected when it is
“
1
”
.
When an internal trigger is selected, A-D conversion is started when
A-D control register 0 bit 6. (A-D conversion start bit) is set to
“
1.
”
When A-D conversion of all selected pins end, the interrupt request
bit of the A-D conversion interrupt control register is set to
“
1.
”
At the
same time, A-D conversion start bit is cleared to
“
0
”
and A-D conver-
sion stops.
When an external trigger is selected, A-D conversion starts when the
A-D conversion start bit is
“
1
”
and a valid edge is input to the AD
TRG
pin. In this case, the A-D conversion result which is stored in the A-D
register 7 becomes invalid.
The operation by external trigger is the same as that by an internal
trigger except that the A-D conversion start bit is not cleared to
“
0
”
after A-D conversion and a retrigger can be available during A-D
conversion.
(4) Repeat sweep mode
Repeat sweep mode is selected when bit 3 of A-D control register 0
is
“
1
”
and bit 4 is
“
1
”
.
The difference from the single sweep mode is that A-D conversion
does not stop after conversion for all selected pins, but repeats again
from the AN
0
pin. The repeat is performed among the selected pins.
Also, no interrupt request is generated. Furthermore, if an internal
trigger is selected, the A-D convension start bit is not cleared. The
A-D register can be read at any time.
Precautions for A-D conversion interrupt
function
Clear the interrupt request bit of the A-D interrupt control register (bit
3 at address 70
16
) before using the A-D interrupt. It is because the
interrupt request bit is undefined just after reset.