19 12-BIT A/D CONVERTER (ADC12A)
S1C17M20/M21/M22/M23/M24/M25
Seiko Epson Corporation
19-3
TECHNICAL MANUAL (Rev. 1.0)
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 ADC12_
n
TRG.SMPCLK[2:0] bits that set the sampling time so that these settings will satisfy the equations
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 = ADC12_
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 ADC12_
n
CTL.MODEN bit to 1.
(Enable ADC12A operations)
4. Configure the following ADC12_
n
TRG register bits:
- ADC12_
n
TRG.SMPCLK[2:0] bits
(Set sampling time)
- ADC12_
n
TRG.CNVTRG[1:0] bits
(Select conversion start trigger source)
- ADC12_
n
TRG.CNVMD bit
(Set conversion mode)
- ADC12_
n
TRG.STMD bit
(Set data storing mode)
- ADC12_
n
TRG.STAAIN[2:0] bits
(Set analog input pin to be A/D converted first)
- ADC12_
n
TRG.ENDAIN[2:0] bits
(Set analog input pin to be A/D converted last)
5. Set the ADC12_
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 ADC12_
n
INTF register.
(Clear interrupt flags)
- Set the interrupt enable bits in the ADC12_
n
INTE register to 1. (Enable interrupts)
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
ADC12_
n
TRG.CNVTRG[1:0] bits.
External trigger (#ADTRGn pin)
Writing 1 to the ADC12_
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 ADC12_
n
CTL.ADST bit enables the ADC12A to accept trigger inputs. After that, A/D conver-
sion is started when an underflow occurs in the 16-bit timer Ch.
k
.
Software trigger
Writing 1 to the ADC12_
n
CTL.ADST bit starts A/D conversion.
Trigger inputs can be accepted while the ADC12_
n
CTL.BSYSTAT bit is set to 0 and are ignored while set to 1.
A/D conversion is actually started in sync with CLK_T16_
k
after a trigger is accepted.
Writing 0 to the ADC12_
n
CTL.ADST bit stops A/D conversion after the one currently being executed has com-
pleted.