![](http://datasheet.mmic.net.cn/30000/M37703M2BXXXSP_datasheet_2359958/M37703M2BXXXSP_437.png)
7703 GROUP
7702/7703 Group User’s Manual
20–10
20.4 Functional description
20.4.5 A-D converter
The M37703’s analog inputs are 4 channels: AN0 to AN2 and AN7.
(1) One-shot and Repeat modes
Set the analog input select bits (bits 2 to 0 at address 1E16) to one of “0002”, “0012”, “0102” and “1112.”
Set the bits of the port P7 direction register which do not have pins corresponding to analog inputs
AN3 to AN6 to “1” to make them output mode.
Figure 20.4.7 shows the structure of the A-D control register and Figure 20.4.8 shows the structure
of the port P7 direction register when using A-D converter.
(2) Single sweep and Repeat sweep modes
Set the bits of the port P7 direction register corresponding to AN0 to AN2 and AN7 pins to “0” to make
them input mode.
Set the bits of the port P7 direction register which do not have pins corresponding to analog inputs
AN3 to AN6 to “1” to make them output mode. The A-D register contents corresponding to analog
inputs AN3 to AN6, which do not have their pins, become undefined.
Fig. 20.4.7 Structure of A-D control register
b7
b6
b5
b4
b3
b2
b1
b0
A-D control register (Address 1E16)
Bit
A-D conversion frequency
(
AD
) select bit
A-D conversion start bit
Trigger select bit
4
A-D operation mode select bits
2
1
0
Bit name
At reset
0
Undefined
RW
Functions
0 0 0 : AN0 selected
0 0 1 : AN1 selected
0 1 0 : AN2 selected
0 1 1 : Not selected
1 0 0 : Not selected
1 0 1 : Not selected
1 1 0 : Not selected
1 1 1 : AN7 selected (Note 2)
b2 b1 b0
0 : Internal trigger
1 : External trigger
0 0 : One-shot mode
0 1 : Repeat mode
1 0 : Single sweep mode
1 1 : Repeat sweep mode
0 : Stop A-D conversion
1 : Start A-D conversion
b4 b3
Notes 1: These bits are ignored in the single sweep and repeat sweep modes. (They may be
either “0” or “1.”)
2: When selecting an external trigger, the AN7 pin cannot be used as an analog input
pin.
3: Writing to each bit except bit 6 of the A-D control register must be performed while the
A-D converter halts.
Analog input select bits
(Valid in one-shot and repeat
modes) (Note 1)
3
7
6
5
Undefined
RW
0
0 : f2 divided by 4
1 : f2 divided by 2