307KB

The following document contains information on Cypress products.
Colophon
The products described in this document are designed, developed and manufactured as contemplated for general use,
including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not
designed, developed and manufactured as contemplated (1) for any use that includes fatal risks or dangers that, unless
extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury,
severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control,
mass transport control, medical life support system, missile launch control in weapon system), or (2) for any use where
chance of failure is intolerable (i.e., submersible repeater and artificial satellite). Please note that Spansion will not be liable
to you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products.
Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such
failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and
prevention of over-current levels and other abnormal operating conditions. If any products described in this document
represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law
of Japan, the US Export Administration Regulations or the applicable laws of any other country, the prior authorization by the
respective government entity will be required for export of those products.
Trademarks and Notice
The contents of this document are subject to change without notice. This document may contain information on a Spansion
product under development by Spansion. Spansion reserves the right to change or discontinue work on any product without
notice. The information in this document is provided as is without warranty or guarantee of any kind as to its accuracy,
completeness, operability, fitness for particular purpose, merchantability, non-infringement of third-party rights, or any other
warranty, express, implied, or statutory. Spansion assumes no liability for any damages of any kind arising out of the use of
the information in this document.
®
®
®
TM
Copyright © 2013 Spansion Inc. All rights reserved. Spansion , the Spansion logo, MirrorBit , MirrorBit Eclipse ,
TM
ORNAND and combinations thereof, are trademarks and registered trademarks of Spansion LLC in the United States and
other countries. Other names used are for informational purposes only and may be trademarks of their respective owners.
Fujitsu Microelectronics Europe
Application Note
MCU-AN-300070-E-V11
FR FAMILY
32-BIT MICROCONTROLLER
MB91460
A/D CONVERTER
APPLICATION NOTE
ANALOG TO DIGITAL CONVERTER
Revision History
Revision History
Date
2008-04-23
2009-09-01
Issue
V1.0, First draft, HPi
V1.1, Corrected calculation of comparison time in chapter 2.2.4.1, MHz
This document contains 27 pages.
MCU-AN-300070-E-V11
-2-
© Fujitsu Microelectronics Europe GmbH
ANALOG TO DIGITAL CONVERTER
Warranty and Disclaimer
Warranty and Disclaimer
To the maximum extent permitted by applicable law, Fujitsu Microelectronics Europe GmbH restricts
its warranties and its liability for all products delivered free of charge (eg. software include or
header files, application examples, target boards, evaluation boards, engineering samples of IC’s
etc.), its performance and any consequential damages, on the use of the Product in accordance with
(i) the terms of the License Agreement and the Sale and Purchase Agreement under which
agreements the Product has been delivered, (ii) the technical descriptions and (iii) all accompanying
written materials. In addition, to the maximum extent permitted by applicable law, Fujitsu
Microelectronics Europe GmbH disclaims all warranties and liabilities for the performance of the
Product and any consequential damages in cases of unauthorised decompiling and/or reverse
engineering and/or disassembling. Note, all these products are intended and must only be used
in an evaluation laboratory environment.
1.
Fujitsu Microelectronics Europe GmbH warrants that the Product will perform substantially in
accordance with the accompanying written materials for a period of 90 days form the date of
receipt by the customer. Concerning the hardware components of the Product, Fujitsu
Microelectronics Europe GmbH warrants that the Product will be free from defects in material
and workmanship under use and service as specified in the accompanying written materials
for a duration of 1 year from the date of receipt by the customer.
2.
Should a Product turn out to be defect, Fujitsu Microelectronics Europe GmbH´s entire liability
and the customer´s exclusive remedy shall be, at Fujitsu Microelectronics Europe GmbH´s
sole discretion, either return of the purchase price and the license fee, or replacement of the
Product or parts thereof, if the Product is returned to Fujitsu Microelectronics Europe GmbH in
original packing and without further defects resulting from the customer´s use or the transport.
However, this warranty is excluded if the defect has resulted from an accident not attributable
to Fujitsu Microelectronics Europe GmbH, or abuse or misapplication attributable to the
customer or any other third party not relating to Fujitsu Microelectronics Europe GmbH.
3.
To the maximum extent permitted by applicable law Fujitsu Microelectronics Europe GmbH
disclaims all other warranties, whether expressed or implied, in particular, but not limited to,
warranties of merchantability and fitness for a particular purpose for which the Product is not
designated.
4.
To the maximum extent permitted by applicable law, Fujitsu Microelectronics Europe GmbH´s
and its suppliers´ liability is restricted to intention and gross negligence.
NO LIABILITY FOR CONSEQUENTIAL DAMAGES
To the maximum extent permitted by applicable law, in no event shall Fujitsu
Microelectronics Europe GmbH and its suppliers be liable for any damages whatsoever
(including but without limitation, consequential and/or indirect damages for personal
injury, assets of substantial value, loss of profits, interruption of business operation,
loss of information, or any other monetary or pecuniary loss) arising from the use of
the Product.
Should one of the above stipulations be or become invalid and/or unenforceable, the remaining
stipulations shall stay in full effect
© Fujitsu Microelectronics Europe GmbH
-3-
MCU-AN-300070-E-V11
ANALOG TO DIGITAL CONVERTER
Contents
Contents
REVISION HISTORY.............................................................................................................. 2
WARRANTY AND DISCLAIMER ........................................................................................... 3
CONTENTS ............................................................................................................................ 4
1 INTRODUCTION................................................................................................................ 6
1.1
Key Features............................................................................................................. 6
2 THE ANALOGUE/DIGITAL CONVERTER........................................................................ 7
2.1
Block Diagram........................................................................................................... 7
2.2
Registers ................................................................................................................... 8
2.2.1
Control Status Register (ADCS1)................................................................. 8
2.2.2
Control Status Register (ADCS0)................................................................. 8
2.2.3
Date Register (ADCR1, ADCR0) ................................................................. 9
2.2.4
Sampling timer and setting register (ADCT1, ADCT0) ............................... 9
2.2.4.1
2.2.5
A/D Channel Setting Register (ADSCH, ADECH) ...................................... 10
2.2.5.1
2.2.6
Sampling/Conversion Time......................................................... 9
Start/Stop Channels.................................................................. 10
Analog Input Enable Register (ADER0 – ADERn) ...................................... 11
3 POWER SUPPLY OF A/D CONVERTER........................................................................ 12
3.1
Power consumption................................................................................................. 12
3.2
Noise consideration................................................................................................. 12
4 ANALOGUE INPUT AND RELATED EXTERNAL CIRCUITS........................................ 14
4.1
External circuits for analogue input ......................................................................... 14
4.2
Input Leakage current consideration....................................................................... 15
5 SAMPLING TIME CONSIDERATION.............................................................................. 17
6 LATCH-UP RELATED TO AVCC/VCC AND LARGE INPUT SIGNAL .............................. 19
6.1
AVCC > VCC .............................................................................................................. 19
6.2
AVCC < VCC............................................................................................................... 19
6.3
UAIN > AVCC or VCC .................................................................................................... 20
6.4
Conclusion .............................................................................................................. 20
7 INPUT IMPEDANCE ........................................................................................................ 21
7.1
Recharging and discharging the Sampling capacitor.............................................. 21
8 ADC EXAMPLE ............................................................................................................... 23
8.1
ADC with interrupts ................................................................................................. 23
MCU-AN-300070-E-V11
-4-
© Fujitsu Microelectronics Europe GmbH
ANALOG TO DIGITAL CONVERTER
Contents
9 ADDITIONAL INFORMATION......................................................................................... 25
LIST OF FIGURES ............................................................................................................... 26
LIST OF TABLES................................................................................................................. 27
© Fujitsu Microelectronics Europe GmbH
-5-
MCU-AN-300070-E-V11
ANALOG TO DIGITAL CONVERTER
Chapter 1 Introduction
1 Introduction
This application note describes the functionality of the Analog/Digital Converter (ADC) and
gives some examples.
1.1
Key Features
•
Minimum conversion time per Channel: 3 µs
•
RC type successive approximation conversion with sample & hold circuit
•
8-bit or 10-bit conversion resolution
•
Sequential channel conversion, once (Single Mode), continuous (Continuous Mode)
and converts one channel, stops and waits for the next activation (Stop Mode)
•
Interrupt generation after conversion selectable
•
Interrupt can trigger DMA to transfer conversion result to memory
•
Triggered by software, external Pin (ATG) or Timer
MCU-AN-300070-E-V11
-6-
© Fujitsu Microelectronics Europe GmbH
ANALOG TO DIGITAL CONVERTER
Chapter 2 The Analogue/Digital Converter
2 The Analogue/Digital Converter
THE BASIC FUNCTIONALITY OF THE ANALOGUE/DIGITAL CONVERTER
2.1
Block Diagram
Figure 2-1 shows the internal block diagram of the ADC.
Figure 2-1: ADC Block Diagram
© Fujitsu Microelectronics Europe GmbH
-7-
MCU-AN-300070-E-V11
ANALOG TO DIGITAL CONVERTER
Chapter 2 The Analogue/Digital Converter
2.2
Registers
2.2.1 Control Status Register (ADCS1)
This register controls the A/D converter and indicates its status.
Bit
No.
15
14
Initial
Value
Name
Explanation
BUSY*
Busy Flag
and Stop*
0
Interrupt
Flag
0
INT
Value
0
1
0
1
13
INTE
Interrupt
enable
0
12
PAUS
A/D
Converter
Pause
0
0
1
0
1
0, 0
11, 10
STS1,0
Start Source
Select
0, 1
0, 0
1, 0
1, 1
9
STRT
8
-
Start
Conversion
Undefined
0
X
0
1
0
Operation
Read: No A/D Conversion
Write: Force Conversion Stop
Read: A/D Conversion ongoing
Write: No effect
Read: No A/D Data
Write: Clear Flag
Read: A/D Data and Interrupt
Write: No effect
Interrupt disabled
Interrupt, if A/D Data
Read: No A/D Conversion Pause
Write: Clear Bit
Read: Pause occurred
Write: No effect
ADC Activation by Software
ADC Activation by Software and ADTG
Pin
ADC Activation by Software and Timer
ADC Activation by Software, ADTG Pin,
and Timer
Always read; Write: no effect
Start and Restart A/D Conversion
Reserved Bit , always write “0” to it
Table 2-1: ADCS1
2.2.2 Control Status Register (ADCS0)
This register controls the A/D converter and indicates its status.
Single Mode 1; Reactivation during
Conversion allowed
Single Mode 2; Reactivation during
0, 1
Conversion not allowed
0, 0
Continuous Mode; Reactivation during
1, 0
Conversion not allowed
Stop Mode; Reactivation during
1, 1
Conversion not allowed
0
10-Bit Conversion Mode
0
1
8-Bit Conversion Mode
Current converted channel is shown
during A/D converting (BUSY="1"). If
Read
conversion is halt by forcibly stopping,
00000
they show the stopped channel.
Write No effect to these bits.
0, 0
7, 6
MD1, 0
Operation
Mode Select
5
S10
10-Bit Mode
4
…
0
ACH4ACH0
A/D
converter
mode set
Table 2-2: ADCS0
* These bits return “1” during Read-Modify-Write instruction.
MCU-AN-300070-E-V11
-8-
© Fujitsu Microelectronics Europe GmbH
ANALOG TO DIGITAL CONVERTER
Chapter 2 The Analogue/Digital Converter
2.2.3 Date Register (ADCR1, ADCR0)
These register stores digital value generated as a result of conversion. This register contains
the last converted value and is rewritten every time the conversion ends.
Bit No.
15
…
10
9
…
0
Name
D9
…
D0
Explanation
Value
Operation
-
0
These bits always return “0”
Data Bits
-
These bits contain A/D data after
successful conversion
Table 2-3: ADCR1 & 2
2.2.4 Sampling timer and setting register (ADCT1, ADCT0)
These registers sets the sampling and conversion time
Bit No.
Name
Explanation
15
…
10
CT5
…
CT0
Comparison
Time Setting
9
…
0
ST9
…
ST0
Sampling
time
Initial Value
Operation
Setting "000001" means one division
(=CLKP).
It’s not allowed to set these bits
0,0,0,1,0,0
"000000"
Note : It’s not allowed to set the
comparison time over 500 us
0,0,0,0,1,
0,1,1,0,0
Sampling time = ST value * CLKP
cycle
Note: It’s not allowed to set the
sampling time below 1.2 us when
AVCC is below 4.5 V.
Table 2-4: ADCT1 & 2
2.2.4.1 Sampling/Conversion Time
The sampling time must be equal to or greater than 0.4 µs. The Comparison time must be at
least 0.6 µs. Therefore an overall A/D conversion time could be 1 µs, but this depends on
the used peripheral clock.
Assume a peripheral clock of 16 MHz (62.5 ns cycle time). The sample cycle number then
has at least to be 8 (0.5 µs) and the comparison time setting can be 1 (0.875 µs). Therefore
the overall A/D conversion time is 1.375 µs.
All these settings are valid for 4.5 V ≤ AVCC ≤ 5.5 V. Please see the hardware manual for
external impedance considerations.
Please consider that the source clock frequency of the Reload Timer (CLKP) depends on the
settings of the Clock Division setting register (DIVR0).
DIVR0_P [3:0]
CLKP
Base Clock
Peripheral Clock Divider
(div-1 to div-16)
to ADC
Figure 2-2: ADC Clock
© Fujitsu Microelectronics Europe GmbH
-9-
MCU-AN-300070-E-V11
ANALOG TO DIGITAL CONVERTER
Chapter 2 The Analogue/Digital Converter
2.2.5 A/D Channel Setting Register (ADSCH, ADECH)
These registers specify the channels for the A/D converter to convert. Do not update these
registers while the A/D converting is operating.
Bit
No.
15
…
13
12
…
8
7
…
5
4
…
0
Name
ANS4
…
ANS0
ANE4
…
ANE0
Explanation
Undefined
Initial
Value
Value
X
0
Starting
Channel
Setting
0
Undefined
X
Ending
Channel
Setting
0
Operation
Reserved Bit , always write “0” to it
00000 Start conversion from Channel 0
…
11111 Start conversion from Channel 31
0
Reserved Bit , always write “0” to it
00000 End conversion at Channel 0
…
11111 End conversion at Channel 31
Table 2-5: ADSCH & ADECH
2.2.5.1 Start/Stop Channels
•
Use start channel = end channel for conversion of only one channel.
•
If start channel is greater then end channel, conversion starts form start channel to
the highest available channel, then from channel 0 to the end channel.
MCU-AN-300070-E-V11
- 10 -
© Fujitsu Microelectronics Europe GmbH
ANALOG TO DIGITAL CONVERTER
Chapter 2 The Analogue/Digital Converter
2.2.6 Analog Input Enable Register (ADER0 – ADERn)
While a pin is used as analog input, corresponding bit in ADER register have to be set to 1. If
a channel between the configured scanning limits is not configured as ADC input (the
corresponding bit in this register is “0”), this channel is skipped during the scanning process.
The following table shows ADERH.
Bit
No.
31
…
16
Name
Explanation
ADE31
…
ADE16
ADC Input
Selection
Initial
Value
Value
Operation
0
Digital I/O Port enabled
1
Analog Input enabled
0
Table 2-6: ADERH
The following table shows ADERL.
Bit
No.
15
…
0
Name
Explanation
ADE15
…
ADE0
ADC Input
Selection
Initial
Value
0
Value
Operation
0
Digital I/O Port enabled
1
Analog Input enabled
Table 2-7: ADERL
© Fujitsu Microelectronics Europe GmbH
- 11 -
MCU-AN-300070-E-V11
ANALOG TO DIGITAL CONVERTER
Chapter 3 Power supply of A/D converter
3 Power supply of A/D converter
ELECTRICAL POWER CONSIDERATIONS
3.1
Power consumption
The power consumption (IR, IA) of the ADC increases in case a conversion is in progress
(ADCS1_BUSY = 1). While the ADC is halted (ADCS1_BUSY = 0), only leakage current (IRH,
IAH) flows. The following diagrams reflect this behaviour:
ADCSH_BUSY
[Bit-value]
1
ADCS1_BUSY=1
0
t
Reference Voltage Current
[mA]
(AVRH, AVRL)
IR
IRH
t
Power Supply Current
[mA] AVCC
IA
IAH
t
Figure 3-1: Power consumption and operating status of ADC
Note:
Please refer to the datasheet in order to get the absolute values of IR, IRH, IA and IAH.
3.2
Noise consideration
Fujitsu microcontroller has implemented an embedded 10-bit Successive Approximated
Register (SAR) ADC. Due to the high resolution, the digital bit stream from the ADC output is
sensitive to the environment noise. For example, 1LSB corresponds to only 4.9mV for
UREF=5V. Hence, the noise introduced from the external circuits must be considered and
should be reduced to the minimum as possible.
MCU-AN-300070-E-V11
- 12 -
© Fujitsu Microelectronics Europe GmbH
ANALOG TO DIGITAL CONVERTER
Chapter 3 Power supply of A/D converter
The reference voltage UREF, which is equal to AVRH-AVRL, is connected to the weighted
capacitor array and the resistor array of the ADC. The noise coupled to AVR will not be
rejected by ADC. This noise will be added to the UREF directly, introducing an error with a
ratio of UNoise/UREF. For example, to keep the error caused by this kind of noise below
0.1LSB, the noise level of UREF must be kept within 0.49mV.
As a result, the pin AVRH and AVRL pins must be connected with low impedance. In
practice often a simple low-pass RC-filter is used for noise reduction. In this case the
reference voltage supply current (see datasheet) has to be taken into account when
calculating the resistor of the filter, in order to minimize the voltage drop while converting.
Normally two capacitors in parallel are recommended, one filtering low frequency noise, the
other one filtering high frequency noise ((10nF–1μF)||(10pF-100pF)). In most cases, this
configuration suppresses the noise efficiently. If very high frequency noise appears in the
environment, an additional noise filter such as a dedicated π mode RC filter might be useful.
The analogue power path AVCC supplies the internal voltage comparator and the analogue
switches of the ADC, while the VCC path supplies all the digital parts in the microcontroller.
Internal parasitic capacitors may couple noise from AVCC to the internal voltage comparator
of the ADC. For this reason, also AVCC should not be connected directly to VCC but filter
should be used, too. For more efficient noise filtering the same configuration as for AVRH is
recommended.
VCC
+5
VSS
AVCC
AVRH
10 Ω
10pF 100pF
10nF
1uF
10pF 100pF
10nF
1uF
10pF 100pF
10nF
1uF
Reference
Voltage
μC
AVRL
Reference
Voltage
AVSS
Figure 3-2: A suggested connection for the power supplies
© Fujitsu Microelectronics Europe GmbH
- 13 -
MCU-AN-300070-E-V11
ANALOG TO DIGITAL CONVERTER
Chapter 4 Analogue input and related external circuits
4 Analogue input and related external circuits
4.1
External circuits for analogue input
Usignal
AVCC
~
Dclamp
R1
Rclamp
AN x
R2
Cnoise
μC
Dclamp
Figure 4-1: A typical external circuit for analogue input
To protect the analogue pins to suffer from an over-voltage, the so-called “clamping resistor”
is usually added to the input pins. The minimum value of the resistor can be chosen as
Rclamp= Uovervoltage/Iclamp,
Where, Iclamp is the specified maximum clamp current in the data sheet.
For some applications, a large clamp resistor is sometimes unacceptable. As a compromise,
an external clamping diode with low leakage current could be added between the input pin
and AVCC pin.
In some cases, the sensor has been biased with a voltage supply higher than the maximum
allowed voltage for the microcontroller. For example, in the automotive applications, the
sensors could be biased directly with the car battery, which exhibits a voltage of 12V/24V. A
resistor divider consisting of R1/R2 is commonly used to tail the sensor voltage signal “seen”
on the pin down to the value which is equal or smaller than AVCC/VCC (see Figure 4-1).
The ratio between R1 and R2 should satisfy the following constrain:
R1 U Signal
≥
−1
R2 AVCC
Other factor which influences the size dimension of R1, R2 and Rclamp, is related to current
consumption budget and the input signal noise suppressing. The second factor will be
discussed here with more detail. The signal from the sensors could be also noisy. The noise,
which has a time constant smaller than the sampling time Tsampling, is transparent to the ADC,
resulting distorted output. In this case, an additional dedicated bypass capacitor together
with the clamping resistor or resistor divider, works as a low pass filter. A larger capacitor will
lower the AC impedance and will be more effective at shunt away the noise signal.
Generally, the time constant of this low pass filter (Rclamp + R1 || R2) x Cnoise should be chosen
considerably larger than the sampling time (5 to 10 times larger with a rule of thumb).
However, at the same time this time constant should be also considerably smaller than the
one of the sensor signal, depending on the applications. In this way, the analogue pin is able
to follow the dynamic changes, which the ADC is being used to track. These, along with the
MCU-AN-300070-E-V11
- 14 -
© Fujitsu Microelectronics Europe GmbH
ANALOG TO DIGITAL CONVERTER
Chapter 4 Analogue input and related external circuits
dimension of R1/R2 or Rclamp must be considered when choosing the capacitor dimension to
avoid rolling off any high frequency signal components of interest.
4.2
Input Leakage current consideration
The analogue input pins show a small leakage current, whose maximum value is about 3μA
and ranged from 3μA down to 1μA depending on the temperature. The leakage current,
which flows through the external resistor, introduces an undesired voltage drop. This error
voltage is a function of the external resistor and the leakage current itself. The following
example shows a dimension of the resistor with this factor taken into consideration. For the
case of using a resistor divider to reduce the error due to leakage current, the size of R1 || R2
+ Rclamp should not be chosen too large and should be according to the following equation:
R1 || R2 + Rclamp ≤
U LSB
I leakage
Note:
ULSB = UREF / 1024
To keep the error smaller than one LSB for a leakage of 3μA, the size of R1 || R2 + Rclamp
should be smaller than 1.6kΩ. As the leakage current drops down to 1 μA, the value of R1 ||
R2 + Rclamp can be chosen as large as 5kΩ. This is considering UREF of 5V.
It is found in the test that the leakage current consists of two parts: one is due to the leakage
current of the input ESD structure. Another leakage current appears only as the multiplexer
is switched on during the sampling time, whose contribution is usually considerably larger
than the one created from ESD structure. The second leakage current can be regarded as a
noise during the sampling time by the bypass capacitor, which is commonly used to filter the
noise from the sensor input. If this capacitor is large enough, it can absorb most of the
second leakage current during the sampling time, eliminating its contribution to the error
voltage.
VCC
Ileakage2 appears after switches
ESD
within the MUX turn on
Ileakage1
Ileakage2
MUX
Reff
Cbypass
Usignal
~
Csampling
Cnoise
ESD
μC
Figure 4-2: Leakage current flowing to the analogue input pin
© Fujitsu Microelectronics Europe GmbH
- 15 -
MCU-AN-300070-E-V11
ANALOG TO DIGITAL CONVERTER
Chapter 4 Analogue input and related external circuits
Leakage
current
Ileakage1+Ileakage2
Ileakage1
Ileakage1
t
Error voltage due to leakage current
without the bypass capacitor
Error
voltage
Error voltage due to leakage current
with the bypass capacitor
t
No active
phase
Sampling
phase
Comparison
phase
Figure 4-3: Reducing the leakage current with the bypass capacitor
To show the effect of the bypass capacitor on reducing the leakage current error, we take a
sampling time of 5μs and a leakage current of 3μA as an example. If we want to keep the
voltage drop due to the second leakage current small than 0.5 LSB, the minimum size of the
bypass capacitor should be chosen as:
C=
MCU-AN-300070-E-V11
3μA × 5μs
≈ 6nF
4.9mV / 2
- 16 -
© Fujitsu Microelectronics Europe GmbH
ANALOG TO DIGITAL CONVERTER
Chapter 5 Sampling time consideration
5 Sampling time consideration
SAMPLING TIME CONSIDERATION
Fujitsu applies an embedded 10-bit successive approximation register ADC with an internal
integrated sampling and hold stage. The signal will charge the sampling capacitor at first and
then the voltage signal on the sampling capacitor will be evaluated by the 10-bit ADC
successively. The time to charge the sampling capacitor to its final value equal to the signal
level is a function of the sampling capacitor Csampling, the external resistor and the internal
switch on-resistor.
To reduce the error caused by the limited sampling time to an acceptable level, the sampling
time should be chosen much larger than the time constant to charge the sampling capacitor.
For example, if we choose a sampling time with a factor 7 of the RC constant, namely,
7 × ( Rextern + Rswitch ) × Csampling . Then the error amounts to e −7 × U REF , corresponding
0.94 × U LSB only.
For MB91467D Series, the on-resistor of the transmission gate amounts to 2.6kΩ and the
sampling capacitor Csampling equals to 11pF at AVCC = 5V. For an external resistor of 2.25kΩ,
the sampling time should be chosen larger than 7 × ( 2.25kΩ + 2.6kΩ) × 11 pF = 0.37 μs by
using above thumb rule.
Rswitch=2.6kΩ (max.)
Sequential
Comparison
Register
Usampling
Rextern
COMP
~
Usignal
Csampling=11pF (max.)
μC
Figure 5-1: Block diagram for ADC in MB91F460D Series
© Fujitsu Microelectronics Europe GmbH
- 17 -
MCU-AN-300070-E-V11
ANALOG TO DIGITAL CONVERTER
Chapter 5 Sampling time consideration
Usampling
Error<[email protected] time=7τ
Usignal
Sampling time
7τ
Figure 5-2: Error related to sampling time
For the Fujitsu microcontroller the sampling time can be set by defining the register bit ST2
to ST0 of the ADC data register (ADCT). Please refer to the hardware manual.
MCU-AN-300070-E-V11
- 18 -
© Fujitsu Microelectronics Europe GmbH
ANALOG TO DIGITAL CONVERTER
Chapter 6 Latch-up related to AVBCCB/VBCCB and large input signal
6 Latch-up related to AVCC/VCC and large input signal
RECOMMENDATIONS TO PREVENT LATCH-UP
Latch-up conditions can permanently damage the device and must be avoided. It is up to the
application to assign any precautions in order to avoid any latch-up condition.
6.1
AVCC > VCC
VCC
ESD D3
1
μC
AVCC
ESD
VSS
Figure 6-1: Latch-up in case AVCC > VCC
Latch-up can happen if AVCC becomes larger than VCC. This might be related to the
application cases that VCC is switched on later than AVCC or VCC is switched off earlier than
AVCC. The ESD diode D3 becomes forward biased, introducing a possible latch-up.
6.2
AVCC < VCC
PMOS
VCC
VCC
D1
Digital
Control
Transmission gate
VSS
VSS
To ADC
AVSS
AVCC
D2
2
Figure 6-2: Latch-up in case AVCC < VCC
This case happens if the analogue pin is used as a digital output pin, the output level is “H”,
and at the same time, AVCC is switched off. In this case, the PMOS in the output is on and
© Fujitsu Microelectronics Europe GmbH
- 19 -
MCU-AN-300070-E-V11
ANALOG TO DIGITAL CONVERTER
Chapter 6 Latch-up related to AVBCCB/VBCCB and large input signal
the parasitic diode D2 of the transmission gate within the analogue multiplex becomes
forward biased. A quiescent current flows through PMOS and D2. In case that a latch-up
does not happen, a reliable logic “1” should not be expected at the output, due to the load
diode D2.
6.3
UAIN > AVCC or VCC
VCC
PMOS
D1
Digital
Control
3
UAIN
Transmission gate
VSS
To ADC
AVSS
AVCC
D2
3
Figure 6-3: Problem in case UAIN > AVCC or VCC
If UAIN becomes larger than VCC or AVCC, then the ESD diode D1 or D2 will be forward
biased. A latch-up can happen. Even if a latch-up does not always happen in this case, the
input signal, which exceeds VCC or AVCC, cannot be converted by the ADC properly.
6.4
Conclusion
It is strongly suggested that AVCC and VCC should be DC short circuit together to avoid any
possible latch-up.
With the presence of AVCC and VCC voltage, an analogue input signal, which is smaller than
AVCC and VCC can be always put on the analogue pins, independent on the MCU modes.
Latch-up conditions can permanently damage the device if the related specified
currents are exceeded. So Latch-up conditions must be avoided under all
circumstances. It is up to the application to assign any precautions in order to avoid
any latch-up condition.
MCU-AN-300070-E-V11
- 20 -
© Fujitsu Microelectronics Europe GmbH
ANALOG TO DIGITAL CONVERTER
Chapter 7 Input Impedance
7 Input Impedance
ADC BEHAVIOR ON HIGH INPUT IMPEDANCES
7.1
Recharging and discharging the Sampling capacitor
Because the ADC uses a sampling capacitor the input impedance must be set to a value
below 15 kΩ to recharge or discharge this capacitor within the sampling time.
Example:
Assume an application uses two ADC inputs. At one pin there is a voltage of about Vcc and
at the other pin Vss. The first conversion charges the internal capacitor to Vcc within the
sample time (A). After this the conversion starts (B). At the second conversion the MUX
switches to the other input and the capacitor is discharged to Vss (C). The second
conversion starts (D). If the input impedance (Z0) is too high, a rest of charge will remain and
a wrong conversion will result.
Figure 7-1: Current flow in the example
The left illustration shows the voltage glitch on AN0 if Z0 is
low.
The glitch occurs, when the sampling switch is closed.
Figure 7-2: Voltage glitch at low input impedance
© Fujitsu Microelectronics Europe GmbH
- 21 -
MCU-AN-300070-E-V11
ANALOG TO DIGITAL CONVERTER
Chapter 7 Input Impedance
In this illustration the input impedance Z0 is too high. The
sampling capacitor is not discharged within the sampling
time and thus a wrong voltage is converted (red circle).
Figure 7-3: Voltage glitch at high input impedance
Note:
At high impedance input circuit, there will always be a glitch of about 0.5 Volts max even if
the previous conversion was at 0 Volt. This results from the ADC internal architecture itself.
For the same reason discussed in this chapter an EMI capacitors for any analogue input pins
should not exceed 1 nF.
MCU-AN-300070-E-V11
- 22 -
© Fujitsu Microelectronics Europe GmbH
ANALOG TO DIGITAL CONVERTER
Chapter 8 ADC Example
8 ADC Example
EXAMPLES FOR THE ADC
8.1
ADC with interrupts
Main.c
/* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */
/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */
/* ELIGIBILITY FOR ANY PURPOSES.
*/
/*
(C) Fujitsu Microelectronics Europe GmbH
*/
/*---------------------------------------------------------------------------*/
void InitADC (void)
{
PFR29_D1 = 1;
/* resource function mode: analog input AN1 */
ADERL = 0x0002;
/* channel 1 to analog input
*/
ADCS0 = 0xA0;
/* ADC set to 8 bit continuous mode
*/
ADCT1 = 0xFF;
/* Comparison time = 39.62uS @ 16MHz CLKP*/
ADCT0 = 0xFF;
/* Sampling time = 63.94uS @ 16MHz CLKP */
ADSCH = 0x01;
/* convert only AN1 */
ADECH = 0x01;
ADCS1 = 0xA2;
/* interrupt enabled, software trigger,
start conversion */
}
void main (void)
{
DDR00 = 0xFF ;
InitIrqLevels();
__set_il(7);
__EI();
/* Data direction Port 0 = Output
*/
/* allow all levels
/* globally enable interrupts
*/
*/
InitADC();
/* init AD - converter
*/
while(1)
__asm("\tnop");
/* waiting for interrupt (no operation)
*/
PFR16 = 0x00;
DDR16 = 0xFF;
PDR16 = 0x00;
}
__interrupt void ISR_ADC (void)
{
PDR16 = ADCR0;
/* shows voltage on Port 0 ( LEDs )
ADCS1 = 0xA2;
/* clear interrupt flag
}
*/
*/
The above example demonstrates to configure ADC in the continuous mode with 8 bit
conversion resolution with interrupts enabled. The maximum possible sampling and
comparison time is used here. After every ADC interrupt the converted data is output to the
LEDs connected to Port 16.
© Fujitsu Microelectronics Europe GmbH
- 23 -
MCU-AN-300070-E-V11
ANALOG TO DIGITAL CONVERTER
Chapter 8 ADC Example
vectors.c
/* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */
/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */
/* ELIGIBILITY FOR ANY PURPOSES.
*/
/*
(C) Fujitsu Microelectronics Europe GmbH
*/
/*---------------------------------------------------------------------------*/
void InitIrqLevels (void)
{
. . .
ICR59 = 30; /* Priority Level 30 for ADC */
. . .
}
/* ISR prototype */
__interrupt void ISR_ADC (void);
. . .
#pragma intvect ISR_ADC 134
. . .
MCU-AN-300070-E-V11
/* ADC */
- 24 -
© Fujitsu Microelectronics Europe GmbH
ANALOG TO DIGITAL CONVERTER
Chapter 9 Additional Information
9 Additional Information
Information about FUJITSU Microcontrollers can be found on the following Internet page:
http://mcu.emea.fujitsu.com/
The software examples related to this application note is:
91460_adc8-v10
91460_adc_rlt-v10
91460_adc8_dma-v14
91460_ppg_rlt_adc_dma-v10
91460_adc8_uart_async-v13
91460_adc10_dma_irq-v12
It can be found on the following Internet page:
http://mcu.emea.fujitsu.com/mcu_product/mcu_all_software.htm
© Fujitsu Microelectronics Europe GmbH
- 25 -
MCU-AN-300070-E-V11
ANALOG TO DIGITAL CONVERTER
List of Figures
List of Figures
Figure 2-1: ADC Block Diagram............................................................................................... 7
Figure 2-2: ADC Clock ............................................................................................................. 9
Figure 3-1: Power consumption and operating status of ADC ............................................... 12
Figure 3-2: A suggested connection for the power supplies .................................................. 13
Figure 4-1: A typical external circuit for analogue input ......................................................... 14
Figure 4-2: Leakage current flowing to the analogue input pin .............................................. 15
Figure 4-3: Reducing the leakage current with the bypass capacitor .................................... 16
Figure 5-1: Block diagram for ADC in MB91F460D Series .................................................... 17
Figure 5-2: Error related to sampling time ............................................................................. 18
Figure 6-1: Latch-up in case AVCC > VCC ................................................................................ 19
Figure 6-2: Latch-up in case AVCC < VCC ............................................................................... 19
Figure 6-3: Problem in case UAIN > AVCC or VCC ..................................................................... 20
Figure 7-1: Current flow in the example................................................................................. 21
Figure 7-2: Voltage glitch at low input impedance ................................................................. 21
Figure 7-3: Voltage glitch at high input impedance................................................................ 22
MCU-AN-300070-E-V11
- 26 -
© Fujitsu Microelectronics Europe GmbH
ANALOG TO DIGITAL CONVERTER
List of Tables
List of Tables
Table 2-1: ADCS1 ..................................................................................................................... 8
Table 2-2: ADCS0 ..................................................................................................................... 8
Table 2-3: ADCR1 & 2 ............................................................................................................ 9
Table 2-4: ADCT1 & 2 ............................................................................................................ 9
Table 2-5: ADSCH & ADECH.................................................................................................. 10
Table 2-5: ADERH ................................................................................................................... 11
Table 2-6: ADERL ................................................................................................................... 11
© Fujitsu Microelectronics Europe GmbH
- 27 -
MCU-AN-300070-E-V11