Lesson: Embedded Systems I/O Analog Interfacing
Lesson: Embedded Systems I/O Analog Interfacing
Lesson: Embedded Systems I/O Analog Interfacing
3 19
Embedded Systems I/O Analog Interfacing
Version 2 EE IIT, Kharagpur 1 Version 2 EE IIT, Kharagpur 2
Instructional Objectives
After going through this lesson the student would be able to
Pre-Requisite Fig. 19.2 The Analog-Digital-Analog signal path with real time processing
Vref: It is reference voltage which decides the range of the input voltage. By making it negative AD_TEST A/D Conversion Test
bipolar inputs can be used. This register specifies adjustments for zero-offset errors.
The microcontroller’s interrupt-handling system has two components: the programmable An A/D conversion converts an analog input voltage to a digital value, stores the result in
interrupt controller and the peripheral transaction server (PTS). The programmable interrupt the AD_RESULT register, and sets the A/D interrupt pending bit. An 8-bit conversion provides
controller has a hardware priority scheme that can be modified by the software. Interrupts that go 20 mV resolution, while a 10-bit conversion provides 5 mV resolution. An 8-bit conversion takes
through the interrupt controller are serviced by interrupt service routines that you provide. The less time than a 10-bit conversion because it has two fewer bits to resolve and the comparator
upper and lower interrupt vectors in special-purpose memory contain the interrupt service requires less settling time for 20 mV resolution than for 5 mV resolution. Either the voltage on
routines’ addresses. The peripheral transaction server (PTS), a microcoded hardware interrupt an analog input channel or a test voltage can be converted. Converting the test inputs is used to
processor, provides high-speed, low-overhead interrupt handling; it does not modify the stack or calculate the zero-offset error, and the zero-offset adjustment is used to compensate for it. This
the Processor Status Word. The PTS supports seven microcoded routines that enable it to feature can reduce or eliminate off-chip compensation hardware. Typically, the test voltages are
complete specific tasks in lesser time than an equivalent interrupt service routine can. It can converted to adjust for the zero-offset error before performing conversions on an input channel.
transfer bytes or words, either individually or in blocks, between any memory locations; manage The AD_TEST register is used to program for zero-offset adjustment. A threshold-detection
multiple analog-to-digital (A/D) conversions; and transmit and receive serial data in either compares an input voltage to a programmed reference voltage and sets the A/D interrupt pending
asynchronous or synchronous mode. bit when the input voltage crosses over or under the reference voltage. A conversion can be
started by a write to the AD_COMMAND register or it can be initiated by the EPA, which can
provide equally spaced samples or synchronization with external events.
Analog Mux: Analog Multiplexer
Once the A/D converter receives the command to start a conversion, a delay time elapses
It selects a particular analog channel for conversion. Only after completing conversion of one before sampling begins. During this sample delay, the hardware clears the successive
channel it switches to subsequent channels. approximation register and selects the designated multiplexer channel. After the sample delay,
the device connects the multiplexer output to the sample capacitor for the specified sample time.
The associated Registers After this sample window closes, it disconnects the multiplexer output from the sample capacitor
so that changes on the input pin will not alter the stored charge while the conversion is in
AD_COMMAND register progress. The device then zeros the comparator and begins the conversion. The A/D converter
This register selects the A/D channel, controls whether the A/D conversion starts immediately or uses a successive approximation algorithm to perform the analog-to-digital conversion. The
is triggered by the EPA, and selects the operating mode. converter hardware consists of a 256-resistor ladder, a comparator, coupling capacitors, and a 10-
bit successive approximation register (SAR) with logic that guides the process. The resistive
AD_RESULT ladder provides 20 mV steps (VREF = 5.12 volts), while capacitive coupling creates 5 mV steps
within the 20 mV ladder voltages. Therefore, 1024 internal reference voltage levels are available
For an A/D conversion, the high byte contains the eight MSBs from the conversion, while the for comparison against the analog input to generate a 10-bit conversion result. In 8- bit
low byte contains the two LSBs from a 10- bit conversion (undefined for an 8-bit conversion), conversion mode, only the resistive ladder is used, providing 256 internal reference voltage
indicates which A/D channel was used, and indicates whether the channel is idle. For a levels. The successive approximation conversion compares a sequence of reference voltages to
8-BIT A/D
Fig. 19.5 The signals of 0809 AD converter
CONTROL & END OF
TIMING CONVERSION Functional Description
(INTERRUPT)
8
CHANNELS
8 ANALOG
MULTIPLE- Multiplexer
XING
INPUTS S.A.R
ANALOG
SWITCHES
TRI-
The device contains an 8-channel single-ended analog signal multiplexer. A particular input
COMPARATOR
STATE channel is selected by using the address decoder. Table 1 shows the input states for the address
OUTPUT
LATCH
8-BIT lines to select any channel. The address is latched into the decoder on the low-to-high transition
OUTPUTS
BUFFER of the address latch enable signal.
SWITCH TREE
TABLE 1
3-BIT ADDRESS ADDRESS
LATCH SELECTED ANALOG ADDRESS LINE
ADDRESS
AND CHANNEL C B A
DECODER
LATCH ENABLE 256R REGISTOR IN0 L L L
LADDER
IN1 L L H
VCC GND REF(+) REF(-) OUTPUT IN2 L H L
ANABLE IN3 L H H
IN4 H L L
Fig. 19.4 The internal architecture of 0809 AD converter
IN5 H L H
IN6 H H L
IN7 H H H
The Converter
This 8-bit converter is partitioned into 3 major sections: the 256R ladder network, the successive
approximation register, and the comparator. The converter’s digital outputs are positive true. The
INTERRUPT
The bottom resistor and the top resistor of the ladder network in Fig.19.6 are not the same value 500 kHz CLK 0E
as the remainder of the network. The difference in these resistors causes the output characteristic ADDRESS 5.000V VREF (+) E0C INTERRUPT
DECODE
to be symmetrical with the zero and full-scale points of the transfer curve. The first output (AD4 – AD15)* 0.000V VREF (-)
transition occur when the analog signal has reached +1⁄2 LSB and succeeding output transitions 2-1 DB7 MSB
occur every 1 LSB later up to full-scale. The successive approximation register (SAR) performs START 2-2 DB6
8-iterations to approximate the input voltage. For any SAR type converter, n-iterations are ALE 2-3 DB5
WRITE
required for an n-bit converter. Fig.19.7 shows a typical example of a 3-bit converter. The A/D 2-4 DB4
AD0 A 2-5 DB3
converter’s successive approximation register (SAR) is reset on the positive edge of the start ADC0808
conversion (SC) pulse. The conversion is begun on the falling edge of the start conversion pulse. AD1 B ADC0809 2-6 DB2
-7
AD2 C 2 DB1
A conversion in process will be interrupted by receipt of a new start conversion pulse.
2-8 DB0 LSB
Continuous conversion may be accomplished by tying the end-of-conversion (EOC) output to the 5V SUPPLY
SC input. If used in this mode, an external start conversion pulse should be applied after power
VCC In7 VIN 8
up. End-of-conversion will go low between 0 and 8 clock pulses after the rising edge of start
GND
conversion. The most important section of the A/D converter is the comparator. It is this section
which is responsible for the ultimate accuracy of the entire converter. GROUND 0-5V ANALOG
INPUT RANGE
In0 VIN 1
The DAC0808 is an 8-bit monolithic digital-to-analog converter (DAC). Fig.19.9 shows the
architecture and pin diagram of such a chip.
Fig. 19.9 The DAC 0808 Signals
MSB LSB
A1 A2 A3 A4 A5 A6 A7 A8 The pins are labeled A1 through A8, but note that A1 is the Most Significant Bit, and A8 is the
Least Significant Bit (the opposite of the normal convention). The D/A converter has an output
current, instead of an output voltage. An op-amp converts the current to a voltage. The output
RANGE
I0
current from pin 4 ranges between 0 (when the inputs are all 0) to Imax*255/256 when all the
CONTROL CURRENT SWITCHES
inputs are 1. The current, Imax, is determined by the current into pin 14 (which is at 0 volts).
Since we are using 8 bits, the maximum value is Imax*255/256. The output of the D/A converter
takes some time to settle. Therefore there should be a small delay before sending the next data to
R-2R LADDER BIAS CIRCUIT GND the DA. However this delay is very small compared to the conversion time of an AD Converter,
therefore, does not matter in most real time signal processing platforms. Fig.19.10 shows a
typical interface.
VREF (+)
NPN CURRENT VCC
SOURCE PAIR
VREF (-)
REFERENCE COMPEN
CURRENT AMP
VEE
19(V) Conclusion
In this lesson you learnt about the following
The internal AD converters of 80196 family of processor
The external microprocessor compatible AD0809 converter
A typical 8-bit DA Converter
Both the ADCs use successive approximation technique. Flash ADCs are complex and therefore
generate difficult VLSI circuits unsuitable for coexistence on the same chip. Sigma-Delta need
very high sampling rate.