VII PERIPHERAL MODULES 5 (ANALOG): A/D CONVERTER (ADC)
VII-1-10
EPSON
S1C33E07 TECHNICAL MANUAL
Starting up the A/D converter circuit
After the settings specified in the preceding section have been made, write 1 to ADE (D2/0x300544) to enable
the A/D converter. The A/D converter is thereby readied to accept a trigger to start A/D conversion. To set the
A/D converter again, or if it is not be used, set ADE to 0.
ADE: A/D Enable Bit in the A/D Control/Status Register (D2/0x300544)
Starting A/D conversion
When a trigger is input while ADE (D2/0x300544) = 1, A/D conversion is started. If a software trigger has been
selected, A/D conversion is started by writing 1 to ADST (D1/0x300544).
ADST: A/D Conversion Control/Status Bit in the A/D Control/Status Register (D1/0x300544)
Only the trigger selected using TS[1:0] (D[4:3]/0x300542) are valid; no other trigger is accepted.
TS[1:0]: A/D Conversion Trigger Select Bits in the A/D Trigger/Channel Select Register (D[4:3]/0x300542)
When a trigger is input, the A/D converter samples and A/D-converts the analog input signal, beginning with
the conversion start channel selected by CS[2:0] (D[10:8]/0x300542).
CS[2:0]: A/D Converter Start Channel Setup Bits in the A/D Trigger/Channel Select Register (D[10:8]/0x300542)
ADST (D1/0x300544) used for the software trigger is set to 1 during A/D conversion, even when it is started by
some other trigger, so it can be used as an A/D-conversion status bit.
The channel in which conversion is underway can be identified by reading CH[2:0] (D[2:0]/0x300542).
CH[2:0]: A/D Conversion Channel Status Bits in the A/D Trigger/Channel Select Register (D[2:0]/0x300542)
Reading out A/D conversion results
Standard mode
Upon completion of the A/D conversion in the start channel, the A/D converter stores the conversion result, in
10-bit data registers ADD[9:0] (D[9:0]/0x300540), and sets the conversion-complete flag ADF (D3/0x300544)
and cause-of-interrupt flag FADE (D1/0x300287). If multiple channels are specified using CS[2:0] (D[10:8]/
0x300542) and CE[2:0] (D[13:11]/0x300542), A/D conversions in the subsequent channels are performed in
succession.
ADD[9:0]: A/D Converted Data Bits in the A/D Conversion Result Register (D[9:0]/0x300540)
ADF: A/D Conversion Completion Flag in the A/D Control/Status Register (D3/0x300544)
FADE: A/D Conversion Completion Interrupt Cause Flag in the Port Input 4–7, RTC, A/D Interrupt Cause
Flag Register (D1/0x300287)
CE[2:0]: A/D Converter End Channel Setup Bits in the A/D Trigger/Channel Select Register (D[13:11]/0x300542)
The results of A/D conversion are stored in ADD[9:0] (D[9:0]/0x300540) each time conversion in one channel
is completed. Since an interrupt can be generated simultaneously, this interrupt is normally used to read out
the converted data. In addition, be sure to reset the cause-of-interrupt flag (by writing 0) to prepare the A/D
converter for the next operation.
Since the cause of interrupt of the A/D converter can also be used to invoke DMA, the conversion results can
automatically be transferred to a specified memory location.
If multiple A/D conversion channels are specified, the conversion results in one channel must be read out prior
to completion of conversion in the next channel. If the A/D conversion currently under way is completed before
the previous conversion results are read out, ADD[9:0] is overwritten with the new conversion results.
If ADD[9:0] is updated when the conversion-complete flag ADF (D3/0x300544) = 1 (before the converted
data is read out), the overwrite-error flag OWE (D0/0x300544) is set to 1. The conversion-complete flag ADF
is reset to 0 when the converted data is read out. If ADD[9:0] is updated when ADF = 0, OWE remains at 0,
indicating that the operation has been completed normally. When reading out data, also read OWE to make sure
the data is valid. Once OWE is set, it remains set until it is reset to 0 in the software. Note also that if OWE is
set, ADF also is set. In this case, read out the converted data and reset ADF.
OWE: Overwrite Error Flag in the A/D Control/Status Register (D0/0x300544)