Microcomputer & Interfacing Lecture 3 The 8086 Instruction sets BY: Tsegamlak Terefe.
ENG3640 Microcomputer Interfacing Week #8 Data Acquisition Systems Part (B)
-
Upload
clyde-townsend -
Category
Documents
-
view
216 -
download
0
Transcript of ENG3640 Microcomputer Interfacing Week #8 Data Acquisition Systems Part (B)
2
Topics
Sensors Signal Conditioning Analog to Digital Converters Sample and Hold Circuit
ENG3640 Fall 2012
4
Sensors and Signal Conditioning
Real
World
Measurand
Transducer
(sensors)
Analog
Mux
Signal
Conditioning
Sample and
Hold Circuit
A/D
ConvMCUD/A
ConvActuator
ENG3640 Fall 2012
Transducers Transducer
a device that converts a primary form of energy into a corresponding signal with a different energy form Primary Energy Forms: mechanical, thermal, electromagnetic, optical,
chemical, etc. take form of a sensor or an actuator
Sensor (e.g., thermometer) a device that detects/measures a signal or stimulus acquires information from the “real world”
Actuator (e.g., heater) a device that generates a signal or stimulus
realworld
sensor
actuator
intelligentfeedbacksystem
5ENG3640 Fall 2012
6
Sensors
Sensors connect the digital world to the analog real world1. Position Based Sensors
2. Force Sensors
3. Temperature Sensors
4. Light Intensity Sensors
5. Pressure Sensors
6. Humidity Sensors
7. ….
ENG3640 Fall 2012
7
Transducers: General Term Transducers convert variable processes such as
pressure, temperature, humidity e.t.c., into electrical signals such as voltage or current. It consists of:
1. Input interface element provides Improved coupling between measurand s(t) and sensor
(matching function) Protection to the sensor from undesirable environmental
effects Conversion of s(t) to another physical variable s1(t) required
by a sensor.2. Sensor3. Output interface element
Input InterfaceElement
SensorOutput
InterfaceElementS(t) X(t)S1(t)
ENG3640 Fall 2012
8
Shaft Angle With Potentiometer
Applications: Accelerator pedal position Steering wheel angle
Voltage Vs changes because of the change in resistance
Simple application of Ohm’s law V = I x R
Shaft angle proportional to voltage Vs
Outputs the angular position of the shaft
ENG3640 Fall 2012
9
Linear Variable Displacement Transformer (LVDT)
Moving iron core changes properties of transformer Iron core position changes
primary/secondary voltage ratio Difference in phase is
measured and transformed to a voltage
Voltage measured is proportional to distance moved.
Applications: Fluid level and flow Deflection of Beams
ENG3640 Fall 2012
10
Strain Gauge: Force Measurement
Resistance varies with the amount of stretching (strain) Flexure can be measured with a
strain gauge Force can also be measured
The change in resistance is detected by measuring the voltage change in a Wheatstone bridge.
ENG3640 Fall 2012
Passive Sensor Readout Circuit
Photodiode Circuits
Thermistor Half-Bridge voltage divider one element varies
Wheatstone Bridge R3 = resistive sensor R4 is matched to nominal value of R3 If R1 = R2, Vout-nominal = 0 Vout varies as R3 changes
VCCR1+R4
11ENG3640 Fall 2012
12
Temperature: Thermocouples
Outputs a voltage that is related to temp at the tip of the probe Seebeck effect: current will flow through a junction of dissimilar metals if
there is a temperature difference The voltage produced is very minute (milli-volts) The relationship between voltage and temperature is non linear
Varies from 6 uV/C to 90 uV/C
ENG3640 Fall 2012
Temperature Sensor Options
Resistance Temperature Detectors (RTDs) Platinum, Nickel, Copper metals are typically used positive temperature coefficients
Thermistors (“thermally sensitive resistor”) formed from semiconductor materials, not metals
often composite of a ceramic and a metallic oxide (Mn, Co, Cu or Fe) typically have negative temperature coefficients
Thermocouples based on the Seebeck effect: dissimilar metals at diff. temps. signal
13ENG3640 Fall 2012
14
Phototransistor: Light Detection
Current through external resistor varies with light intensity
Can be used to detect light levels or movement
Sensitive to different colors or wavelengths of light
ENG3640 Fall 2012
15
Output Transducers: ActuatorsActuators
Some common actuators include solenoids, relays, (triacs, SCRs switch ac currents).
An increasing analog signal at the gate of the MOSFET increases the amount of current drawn through the dc motor shunt field (field control).
A relay is an electromagnetic switch with a coil and one or more contacts. Applying voltage to the coil will
cause open contacts to close and vise versa.
A solenoid is like a relay but moves a mechanical cylinder instead of electrical contacts.
ENG3640 Fall 2012
16
Example
A Temp sensor has a measurement range of -10 to 140C. The output range is -2.5 to +5V. The sensor is connected to an 8-bit A/D. Indicate the offset, span, step size and resolution. Also what is the digital output of the A/D if the temp is +10C?
SOLUTION:1. Offset -2.5V, -10C2. Span 5 – (-2.5V) = 7.5 V, 140C – (-10) = 150C3. Step Size 7.5/28 = 29mv, 150/28 = 0.59C4. Resolution 29mv at 8-bit To find the digital output of A/D we have to solve the
following equation (assuming relationship is linear!) Analog number = m x measurement + K
ENG3640 Fall 2012
17
Cont .. Example
1. 5v = 140C x m + K
2. -2.5v = -10C x m + K
Subtract 2 from 1
7.5v = 150 C x m
m = 7.5V/150C
m 0.05V/C Solve for K:
140C x (0.05V/C) + K = 5V
K -2V Analog output 10C x 0.05V/C – 2V = -1.5V Digital Number = (Analog Number – Offset)/Step Size
Digital output -1.5V – (-2.5V)/29mv = (34.8)10 == (22)16
ENG3640 Fall 2012
18
Signal Conditioning Raw sensor outputs are not always suitable for A/D
conversion. Signal conditioning circuits typically amplify the raw signal
from the sensor (i.e. thermocouple) Signal conditioning also provides:
1. buffering,
2. filtering,
3. offset shifting
Most signal conditioning circuits employ operational amplifiers
ENG3640 Fall 2012
20
Voltage Scaling There are situations in which the transducer output
voltage are in the range of 0 ~ VZ, where VZ < VDD. Because VZ sometimes can be much smaller than VDD, the A/D converter cannot take advantage of the available full dynamic range, and therefore conversion results can be very inaccurate.
A voltage scaling circuit can be used to improve the accuracy because it allows the A/D converter to utilize its full range.
Example: Suppose the transducer output voltage ranges from 0V to
100mV. Design a circuit to scale this range to 0~5V.
ENG3640 Fall 2012
21
Voltage Scaling Circuit
AV = 1 + (R2/R1) = (5V/0.1V) = 50
R2/R1 = 49
Choose R1 = 6.8K, Then R2 = 330K. The R2/R1 ratio is 48.53. Error is smaller within 0.3%.
VOUT
+VIN
R1 R2
OP AMP
Figure 10.4 A voltage scaler
ENG3640 Fall 2012
22
The Unity-Gain Buffer or Voltage Follower
Signal conditioning can also provide buffering so that the sensor signal is not affected by anything else
connected to the circuit (i.e. minimize loading high input impedance and low output impedance)
22ENG3640 Fall 2012
23
Voltage Shifting-Scaling Circuit There are transducers whose outputs are in the range of
V1~V2 instead of 0V~VDD
(V1 can be negative and V2 can be smaller than VDD) The accuracy of A/D conversion can be improved by
using a circuit that shifts and scales the transducer output so that it falls in the full range of 0V~VDD.
A Level Shifting/Scaling Circuit would consist of:I. A summing circuit
II. Inverting voltage follower
ENG3640 Fall 2012
24
By choosing
Appropriate values
For V1 and the
Resistors, the
Desired voltage
Shifting and scaling
Can be achieved.
24
25
Example Choose the appropriate values of resistors and the adjusting voltage so that voltage shifting/scaling circuit can shift the voltage from –1.5V ~ 3.5V to 0V ~ 5V.
Solution:
0 = -1.5 × (Rf/R1) – (Rf/R2) × V1
5 = 3.5 × (Rf/R1) – (Rf/R2) × V1
By choosing V1 = - 12V and Rf = R1 = R0 = 15K, R2 is solved to be 120K.
Voltage Shifting/Scaling Circuit
ENG3640 Fall 2012
26
A Difference Amplifier. Use superposition to
perform analysis If (R4 = R2), (R3 = R1) then
Vo = R2/R1 (V2 – V1) Can be used to shift offset
ENG3640 Fall 2012
28
Analog-to-Digital Converters: Types
A/D converters are classified according to several characteristics
Resolution (number of bits) typically 8 bits to 24 bits Speed (number of samples per second) – several
samples/sec to several billion samples/sec Accuracy – how much error there is in the conversion
Classification Staircase ADC Successive Approximation Converters Tracking ADC Flash A/D Converters Integrating A/D Converters
ENG3640 Fall 2012
29
Flash A/D: Comparators
A Flash A/D utilizes comparators and encoders. A comparator compares two voltage values on its two
inputs. If the input on the + input is greater than the voltage
on the – input, the output will be logic high
29ENG3640 Fall 2012
31
Flash A/D: Priority Encoder Example: 4-to-2 line encoder
Chooses the input with highest priority An extra output “V” could be used to validate output
31ENG3640 Fall 2012
33
Flash (Parallel) A/D Converter
Flash A/D converters can sample at several billion samples/sec
A flash A/D Converter is the simplest to understand.
It compares an input voltage Vin to a large number of reference voltages
An n-bit flash uses 2n – 1 comparators!!!
The output is determined by which of the two reference voltages the input signal is between.
Each succeeding comparator switches from a low output to a high level as the analog input increases by q.
The largest flash A/D converter is 8-bits (255 comparators!)
3-bit A/D Converter
Pri
orit
y E
nco
der
ENG3640 Fall 2012
34
Integrating A/D Converters
One of the lowest cost A/D Converters (often used in digital voltmeters)
Slow used if parameter being measured is changing slowly (i.e., temperature)
Has an advantage in noisy environments (noise rejection capability)
Types: Single Slope Integrator Dual Slope Integrator
ENG3640 Fall 2012
35
The Dual-Slope A/D Conversion Method S2 is closed to discharge the capacitor S1 switches between VA and VREF
During the 1st period, converter integrates input signal VA for fixed time (T1) During 2nd period input is connected to VREF of opposite polarity so integration
proceeds to zero during variable time (T2) The counter will count during T2 representing input signal
ENG3640 Fall 2012
36
The Dual-Slope A/D Conversion Method The limited integration period results in normal-mode noise
rejection only when the integration period is equal to one or more periods of the noise signal.
The time integral of this noise over integer multiples of the noise period is ZERO.
At 60Hz minimum signal integrate time is 16.7 ms
ENG3640 Fall 2012
37
Binary Weighted DAC
The binary weighted DAC covered earlier is used for small word size systems. Why?
Two major problems1. The large resistor spread required for large word sizes
i.e. R0 = 2R1 = 4R2 = 8R3 ….2. Problem with large resistor spread is difficulty of IC Fabrication3. If value of LSB is inaccurate or drifts slightly due to temp change leads to an
output error that is larger than 1 LSB Solution?
ENG3640 Fall 2012
38
Inverted R-2R Ladder Circuit
Is used to solve the problem of resistor spread and minimize drift problem in DACs with large value of N. The spread of
resistance value for the ladder is now only a 2:1 spread.
ENG3640 Fall 2012
39
Inverted R-2R Ladder: Analysis
MSB LSB
I0 = VREF/R? I1 = VREF/2R I1 will split in half in second node I2 = I1/2 VREF/4R Each succeeding vertical resistor has a value of current flow equal to half
that of previous I1 = 2 I2 = 4 I3 = … = 2N-1 IN
Thus as in binary weighted resistive network, the currents controlled by the switches are binary weighted.
I0
2R//2R = R
ENG3640 Fall 2012
40
The Glitch Problem in DACS A Significant problem occurring in DACs is that of glitching. Certain systems that are driven by a DAC ignore the glitches such as
DC motors (do not respond to these sharp transients) Bits of the code do not change simultaneously Solution? Use a Sample/Hold circuit
ENG3640 Fall 2012
42
Sample and Hold Circuit: Practical Circuit S/H circuit is a high quality capacitor and semiconductor switch. If analog signal changes rapidly during conversion (errors may be
introduce) S/H reduces these errors by quickly sampling the signal and holding it
STEADY while A/D converts Buffer amplifier (voltage follower) has high input impedance to decrease the
discharge of the capacitor. S1, closes during sampling period allows input signal to charge Ch
S1, opens up again leaving capacitor charged to the value of analog input signal.
ENG3640 Fall 2012
43
Sample and Hold Circuit: When is it required? A S/H is required if: The analog input changes more than one resolution
during the conversion time. Let dz/dt be the rate of change (max slope) of the ADC input voltage Let ΔZ be the ADC resolution Let Tc be the ADC conversion time.
A S/H is required if dz/dt . Tc > 0.5 ΔZ
43ENG3640 Fall 2012
44
Sample and Hold Circuit: Example Assume we want to design a system to measure heart sounds, x. The
useful range of y (output of microphone) is from -10 to +10mV. The desired resolution ΔY, is 0.1mV. The maximum dy/dt is 2 V/s. What is the ADC conversion required to eliminate the need for a S/H?
SignalProcessing
ADCMicrophone
x yZ n
I. dy/dt x Tc <= 0.5 ΔY
II. TC = (0.5 ΔY)/(dy/dt)
III. TC = (0.5 x 0.0001 V) / 2 V/s = 25 µ seconds.
44ENG3640 Fall 2012
45
Signal Sampling Rate
The rate at which you sample a signal depends on how rapidly the signal is changing.
If you sample a signal too slowly, the information about the signal may be inaccurate.
To get full information about a signal you must sample more than twice the highest frequency in the signal (Nyquist Criteria)
Practical systems typically use a sampling rate of at least four times the highest frequency in the signal.
ENG3640 Fall 2012
47
Summary There are two errors introduced by the sampling
process: Voltage quantization due to finite word size of ADC Time quantization caused by the finite discrete
sampling interval Use a binary weighted DAC when resolution
required is small, else use a ladder type DAC A sample and hold circuit should be used when
signal is changing fast for ADC or if you want to avoid glitch problems in DAC.
Flash ADC are fastest but expensive (use only if speed is of importance).
A successive approximation based ADC is suitable for most applications.
ENG3640 Fall 2012
49
Successive Approximation A/D Is based on intelligent trial-and-error method Requires N clock periods for N-bit converter.
ENG3640 Fall 2012