EE 120 - Interfacing With The Analog World
EE 120 - Interfacing With The Analog World
EE 120 - Interfacing With The Analog World
Figure 1. ADC and DAC in a digital system interfacing a computer to the analog world.
Five parts: 1. Transducer The physical variable is usually a nonelectric quantity Transducer converts that physical variable to an electrical variable Examples: thermistors, photocells, photodiodes, flow meters, pressure transducers, tachometers, light-dependent resistors (LDRs) Output can either be analog current or voltage proportional to the monitored variable Example: A thermistor (and associated circuitry) may have a corresponding range of voltages of 800 to 1500 mV while measuring a temperature range of 80 to 150 F. Thus we can say that a 1-F change corresponds to a 10mV difference.
2. Analog-to-Digital Converter (ADC) Converts the analog input from the transducer output into a digital signal Output digital signal consists of a number of bits that represent the analog quantity Continuation of example: 800-1500mV may be represented as 01010000 (80) to 10010110 (1500). Each unit of the digital output hence represents 10 mV. 3. Computer 4. Digital-to-Analog Converter (DAC) Converts a computers digital output into a proportional analog value (voltage or current) 5. Actuator A device or circuit that controls the physical device Example continuation: the actuator may be an electrically controlled valve which would regulate the flow of water into the tank. The flow would then be proportional to the voltage, with 0mV no flow and 10 V producing the maximum flow. Digital-to-Analog Conversion Takes a value in digital form (such as straight binary or BCD) and converts it to a proportional current or voltage quantity.
VREF reference value, determines the full-scale output (i.e. maximum DAC output) Digital inputs taken from output registers of digital system For this example, we have 24 possible outputs. Each input corresponds to a unique output Vout (if current reference, then Iout) Also, in this example, the value of Vout is equal to the digital equivalent of the binary inputs (which is not always the case)
In general: analog output = K x Digital input Where K proportionality factor, constant for a DAC In figure 2, we can determine K = 1 V, such that Vout = (1 V) x Digital input Therefore, if the above DAC has a circuit input of 11002, then Vout = 1 x 12 = 12 Volts. Examples: 1. A five-bit DAC has a current output. For a digital input of 101002, an output current of 10mA is produced. What will Iout be for a digital input of 11101? 2. What is the largest value of output voltage from an eight-bit DAC that produces 1.0 Volts for a digital input of 001100102? Analog Output Output of DAC is only pseudo-analog in nature We can approximate analog signal by increasing # of input bits and decreasing difference between states (i.e. proportionality factor)
Input Weights Similar to number systems, each bit of the input to a DAC has a different weight, according to their position For a binary input, weights are successively doubled for each bit, beginning with the LSB. Thus ,Vout = weighted sum of digital inputs
Example: A five-bit DAC has a Vout of 0.2 Volts for a digital input of 00001. Find Vout for an input of 11111. Resolution (Step size) Defined as the smallest change that can occur in the analog output as a result of a change in the digital input Equal to the weight of the LSB Also referred as the step size The higher the resolution, the closer a DAC output is to an analog output
Consider the following: the inputs to a four-bit DAC is the outputs of a four-bit binary counter
Output is a staircase waveform of 16 levels, but only 15 steps between the end levels. For an N-bit DAC, there are 2N different levels, with 2N-1 steps. Step size is also K, the proportionality constant. Another equation: resolution
Examples: 1. What is the resolution of the above five-bit DAC converter? Describe the staircase signal out of this DAC and how it can be generated. 2. What will be the output of this DAC for a digital input of 100012? Percentage Resolution-expression of resolution as a percentage of the full-scale output
%resolution
Example: A 10-bit DAC has a step size of 10mV. Determine the full-scale output voltage and the percentage resolution. Note: only the number of bits determines the % resolution. Increasing the number of bits increases the resolution; designer must choose resolution as required.
Example: The figure below shows a computer controlling the speed of a motor. The 0- to 2-mA analog current from the DAC is amplified to produce motor speeds of 0 to 1000 rpm. (a) How many bits should be used if the computer is to be able to produce a motor speed within 2 rpm of the desired speed?
(b) Using nine bits, how close to 326 rpm can the motor speed be adjusted? BCD Input Code
Four-bit code groups are used per digit This particular DAC can output 00 to 99. The binary weight proportions (1x, 2x, 4x, 8x, etc) are the same in each code group but the relative weights of each code group differ by a factor of 10.
Example 1: If the weight of A0 in figure 4 is 0.1 V, find (a) step size, (b) full-scale output and percentage resolution, and (c) Vout for D1C1B1A1 = 01012 and D0C0B0A0 = 10002 Example 2. A certain 12-bit BCD DAC has a full-scale output of 9.99 Volts. Determine the (a) percentage resolution, and (b) converters step size.
Bipolar DACs Most DACs are designed to produce both positive and negative values, i.e. -10 to +10 V This is done by using signed binary numbers, with the MSB as the sign bit. Input values are often represented in 2s complement form
Example: A six-bit bipolar DAC uses the 2s complement system and has a resolution of 0.2 volts. (a) What is the range of inputs, in their binary form and true magnitude equivalent form? Solution: most negative input is 100000 (-31) and 011111 (+31), which correspond to analog outputs of -6.4 to +6.2 Volts. (b) How many steps are there in the DAC? Solution: # of steps = 2N 1 = 26 1 = 63 steps of 0.2 Volts each. DAC Circuitry
Rf Rf Rf Rf Va Vb Vc Vd ) , however the Ra Rb Rc Rd
negative sign is not much of a concern. Note the relative weights of the resistors; each represents the binary weighting of each bit
Example: In the DAC circuit above, (a) what is the resolution? (b) What is the weight of each input? (c) If Rf was reduced to 250 , what is the full-scale rating? Solution (a): The resolution is the weight of the LSB = 5 x 1/8 = 0.625 V.
Analog-to-Digital Conversion (ADC) More complex and time-consuming than DAC Internal circuitry often involves a DAC
Example block diagram (not ALL ADCs follow this type)- the digital-ramp ADC
Conversion process: 1. Start command pulse initiates operation 2. At a rate determined by the clock, the control unit continually modifies the binary number in the register 3. DAC converts this binary number to an output voltage Vax 4. A comparator op-amp checks if the output Vax > Va (the analog input reference). When it exceeds Va by a certain level VT , the control unit stops. 5. Control logic sends out EOC (end-of-conversion) signal to indicate completion.
Digital-ramp ADC
Step-by-step operation 1. START pulse resets counter to 0, as well as prevents clock inputs to pass through the AND gate towards the counter. 2. Initially, all counter outputs are 0, thus DAC output Vax = 0. 3. Since Va > Vax, EOC is HIGH. 4. When START becomes low, the AND gate is enabled and clock pulses start entering the counter. 5. As the counter increases, the DAC output, Vax, increases one step at a time. 6. This continues until Vax > Va by some value VT (usually 10 100 V). This will cause EOC to go LOW and inhibit the AND gate from accepting any more pulses. 7. The HIGH-to-LOW transition of the active low EOC signals the end of the conversion 8. The counter will hold the digital value until the next START signal for another conversion. Example: Let clock frequency = 1 MHz, VT = 0.1 mV, and a 10-bit DAC with a full-scale output of 10.23 volts. Determine (a) the digital equivalent for 3.728 V, (b) conversion time, (c) the converter resolution. Reference: Tocci, R.J., Widmer, N.S. 2001. Digital Systems: principles and applications, 8th ed. Prentice-Hall