![](http://datasheet.mmic.net.cn/120000/ML66525-XXTB_datasheet_3559839/ML66525-XXTB_436.png)
Chapter 14
A/D Converter
XIV - 34
Operation
An example setup procedure, with a description of each step is shown below.
..
The result of conversion can be read out by generating an interrupt. In that case, it is not
necessary to wait for the AN0EN flag since an interrupt is generated after the result is stored
in AN0BUF00.
..
Setup Procedure
Description
(1) Stop the A/D converter operation
AN0CTR0(0x0000A400)
bp7: AN0EN=0
bp5: AN0TRG=0
(1) Set the AN0EN and AN0TRG flags of the A/D0
conversion control register (AN0CTR0) to “0” to stop
the A/D conversion.
(2) Set the AN0CTR0 register
Set the operation mode
AN0CTR0(0x0000A400)
bp1-0: AN0MD1-0=00
Set the conversion clock
AN0CTR0(0x0000A400)
bp4-2: AN0CK2-0=010
Set the conversion channel
AN0CTR0(0x0000A400)
bp10-8: AN0CH2-0=000
Set the power-down mode
AN0CTR0(0x0000A400)
bp6: AN0OFF=1
Set the AN0CTR1 register
Set the S/H cycle
bp5-4: AN0SHC1-0=10
(2) Set the AN0MD1-0 flags of the AN0CTR0 register to
“00”to set “any single channel/one-time conversion” to
operation mode.
Set the AN0CK2-0 flags of the AN0CTR0 register to
“010” to set 3 dividing of IOCLK to the conversion
clock.
Set the AN0CH2-0 flags of the ANOCTR0 register to
“000” to set “channel 0” to the conversion channel.
Set the AN0OFF flag of the ANOCTR0 register to “1” to
set operation mode to the power-mode flag.
Set the AN0SHC1-0 flags of the AN0CTR0 register to
“10” to set 4 cycles to S/H cycle.
*After shifted to operation mode, more than 100nsec
wait time is necessary until A/D conversion starts.
.
(3) Start the A/D converter operation
AN0CTR00(0x0000A400)
bp7: AN0EN=1
(3) Set the AN0EN flag of the AN0CTR0 register to “1” to
start A/D conversion. Conversion is started at the rising
edge of the first A/D conversion clock after the flag is
set to “1”. The conversion time is 15cycles of the A/D
conversion clock (1.5
s).
(4) Wait the A/D conversion operation completed
AN0CTR00(0x0000A400)
bp7: AN0EN
(4) Wait for conversion to be completed . The AN0EN flag of
the AN0CTR0 register is to “1” during conversion and
cleared to “0” after conversion is completed. Wait for
The AN0EN flag to be to “0” by program.
(5) Read the A/D value
AN0BUF00(0x0000A410)
(5) The A/D0 conversion data buffer 0 (AN0BUF00) is read
out.