19 12-BIT A/D CONVERTER (ADC12A)
S1C31D50/D51 TECHNICAL MANUAL
Seiko Epson Corporation
19-3
(Rev. 2.00)
For the R
ADIN
and C
ADIN
values in the equivalent circuit, refer to “12-bit A/D Converter Characteristics” in the
“Electrical Characteristics” chapter. Based on these values, configure the ADC12A operating clock CLK_T16_
k
and the ADC12A_
n
TRG.SMPCLK[2:0] bits that set the sampling time so that these settings will satisfy the equa-
tions shown below.
t
ACQ
= 8
×
(R
S
+ R
ADIN
)
×
C
ADIN
(Eq.
19.1)
1
————
×
SMPCLK > t
ACQ
(Eq.
19.2)
f
CLK_ADC
Where
f
CLK_ADC
: CLK_T16_
k
frequency [Hz]
SMPCLK: Sampling time = ADC12A_
n
TRG.SMPCLK[2:0] bit-setting (4 to 11 CLK_T16_
k
cycles)
The following shows the relationship between the sampling time and the maximum sampling rate.
f
CLK_ADC
Maximum sampling rate [sps] = ———————
(Eq. 19.3)
13
19.4 Operations
19.4.1 Initialization
The ADC12A should be initialized with the procedure shown below.
1. Assign the ADC12A input function to the ports. (Refer to the “I/O Ports” chapter.)
2. Configure the 16-bit timer Ch.
k
operating clock so that it will satisfy the sampling time.
3. Set the ADC12A_
n
CTL.MODEN bit to 1.
(Enable ADC12A operations)
4. Configure the following ADC12A_
n
TRG register bits:
- ADC12A_
n
TRG.SMPCLK[2:0] bits
(Set sampling time)
- ADC12A_
n
TRG.CNVTRG[1:0] bits
(Select conversion start trigger source)
- ADC12A_
n
TRG.CNVMD bit
(Set conversion mode)
- ADC12A_
n
TRG.STMD bit
(Set data storing mode)
- ADC12A_
n
TRG.STAAIN[2:0] bits
(Set analog input pin to be A/D converted first)
- ADC12A_
n
TRG.ENDAIN[2:0] bits
(Set analog input pin to be A/D converted last)
5. Set the ADC12A_
n
CFG.VRANGE[1:0] bits.
(Set operating voltage range according to V
DD
)
6. Set the following bits when using the interrupt:
- Write 1 to the interrupt flags in the ADC12A_
n
INTF register.
(Clear interrupt flags)
- Set the interrupt enable bits in the ADC12A_
n
INTE register to 1. (Enable interrupts)
7. Configure the DMA controller and set the following ADC12A control bit when using DMA transfer:
- Write 1 to the DMA transfer request enable bit in the
ADC12A_
n
DMAEN register.
(Enable DMA transfer requests)
19.4.2 Conversion Start Trigger Source
The trigger source, which starts A/D conversion, can be selected from the three types shown below using the AD-
C12A_
n
TRG.CNVTRG[1:0] bits.
External trigger (#ADTRGn pin)
Writing 1 to the ADC12A_
n
CTL.ADST bit enables the ADC12A to accept trigger inputs. After that, the falling
edge of the signal input to the #ADTRG
n
pin starts A/D conversion.
16-bit timer Ch.k underflow trigger
Writing 1 to the ADC12A_
n
CTL.ADST bit enables the ADC12A to accept trigger inputs. After that, A/D con-
version is started when an underflow occurs in the 16-bit timer Ch.
k
.
Software trigger
Writing 1 to the ADC12A_
n
CTL.ADST bit starts A/D conversion.