Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Stray voltage wikipedia , lookup
Voltage optimisation wikipedia , lookup
Pulse-width modulation wikipedia , lookup
Mains electricity wikipedia , lookup
Integrating ADC wikipedia , lookup
Buck converter wikipedia , lookup
Switched-mode power supply wikipedia , lookup
Schmitt trigger wikipedia , lookup
Power electronics wikipedia , lookup
Resistive opto-isolator wikipedia , lookup
Rectiverter wikipedia , lookup
Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010 Digital and Analog ◊ Digital systems are discrete, meaning they have a finite numerical value. Sometimes referred to as “fixed” or “stepped” values. ◊ Analog values are continuous, meaning they have a value that can vary continuously. The values can be to a great degree of precision and may contain more information such as frequency, phase, etc… ◊ Analog values make up real-world values that can be measured. ◊ This presentation describes methods for converting digital values to analog values. DAC 1.2 Digital to Analog ◊ Digital electronics offers advantages over analog in processing, data manipulation, storage and analysis of values. ◊ Often these digital circuits must interface with the real world: ◊ as inputs to analyze, process and manipulate ◊ as outputs to control the physical environment ◊ It is important to establish a means of converting between digital systems and the real world. DAC 1.3 Transducers ◊ Transducers are devices that convert physical quantities into electrical quantities. There are many possible physical measurements requiring many types of transducers: ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ Light Pressure Speed Flow Angle Temperature Rotation Vibration Sound, … DAC 1.4 Actuators ◊ Actuators are electrically controlled devices that control the physical environment. There are many types of actuators available. These include: ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ motors solenoids (electromagnetic non-rotational motion) relays pumps valves lifts heaters acoustic devices, … DAC 1.5 Analog versus Digital Distorted Analog signal Original Analog signal 000000100000010000101000 101000011010010011001110 101000100000101000101000 011010010011001110101000 100000001000010100000010 000101000101000011010010 011001110101000100001010 000110100100110011101010 001010111011011010001001 Binary signal DAC 1.6 Analog to Digital Original Analog signal A to D Conversion The voltage is converted to a binary value at regular intervals. Animated 000100110111101010001 000111000000100000010 011100101001001011101 011110010101010010101 010101001001010101001 000101001010101111010 000001001011101011101 000000010101110101010 000000000001001111010 000000000000111111010 000000000001010101010 000000000001011011101 000000000001101101100 000000001100010111010 000000100011111010110 000001001010101000100 000001010111101111000 000011001101010100101 000110111000010100101 … Binary signal DAC 1.7 Digital to Analog 000100110111101010001 000111000000100000010 011100101001001011101 011110010101010010101 010101001001010101001 000101001010101111010 000001001011101011101 000000010101110101010 000000000001001111010 000000000000111111010 000000000001010101010 000000000001011011101 000000000001101101100 000000001100010111010 000000100011111010110 000001001010101000100 000001010111101111000 000011001101010100101 000110111000010100101 … Digital signal Animated D to A Conversion Analog signal The binary value is converted to a voltage at regular intervals. DAC 1.8 Digital to Analog Converters ◊ Digital to Analog Converters take a digital value and convert it to voltage or current over time. ◊ Converting discrete values to analog values has some challenges. Invariably, the analog value will retain some of the discrete steps from the digital value. ◊ Note that our discussions will focus on the output voltages but these are also applicable to output current. DAC 1.9 Scale ◊ The range of the available digital values, based on the number of bits in the binary number, represents the full scale. ◊ lowest binary value represents the lowest voltage ◊ highest binary value represents the highest voltage ◊ The maximum and minimum voltage must be known to determine the scale. ◊ The Full Scale Output is the maximum value that the DAC can produce for the design. DAC 1.10 Min binary = 0000 Max binary = 1111 Scale Example MSB LSB D C B A VOUT DAC Min VOUT = 0V Max desired VOUT = 7.5V There are 16 values from 0000 to 1111, but the first step (0000) equals 0. Therefore, 15 steps for an output range of 7.5 Volts. The scale will be 0.5 Volts per binary increment. A FS K n (2 1) D C B A VOUT 0 0 0 0 0.0 0 0 0 1 0.5 0 0 1 0 1.0 0 0 1 1 1.5 0 1 0 0 2.0 0 1 0 1 2.5 0 1 1 0 3.0 0 1 1 1 3.5 1 0 0 0 4.0 1 0 0 1 4.5 1 0 1 0 5.0 1 0 1 1 5.5 1 1 0 0 6.0 1 1 0 1 6.5 1 1 1 0 7.0 1 1 1 1 7.5 AFS = Analog Full Scale Voltage DAC 1.11 Scale Calculation ◊ A 4-bit DAC has an output of 1.0 Volts with a binary value of 1010. ◊ What is the output voltage if the binary value is 1100? ◊ What is the Full Scale Output voltage? ◊ An 8-bit DAC has an output of 12.0 Volts with a binary value of 00111100. ◊ What is the K value? ◊ What is the Full Scale Output voltage? DAC 1.12 Scale Example ◊ Analyzing the voltage output from the example it becomes evident that the output voltage, although analog, still follows a pattern of discrete values. DAC 1.13 Input Weights ◊ Binary numbers have positional weighting. The value adjacent to the LSB has a weight of 2 times the LSB, the position adjacent to this has a weight of 4 times the LSB and the MSB has a weight of 8 times the LSB. 10112 23 ◊ ◊ 22 21 20 In our example, each LSB change represented a 0.5V change to the output. By following the weights of the inputs starting from the LSB, the next value represents 1.0V (2x the LSB), the next value represents 2.0V (4x the LSB) and the MSB represents 4.0V (8x the LSB). With this in mind, a binary 1011 for our example should represent: 4.0V + 1.0V + 0.5V = 5.5 Volts DAC 1.14 Resolution ◊ The resolution represents the smallest change, or step, in the analog output. The greater the resolution, the smaller the steps. ◊ To increase resolution increase the number of bits in the binary value. ◊ In our example, a 4-bit number represented a 0.5 volt change per step. By increasing the number to 5 bits, each change would represent approximately 0.25 volt change per step, increasing the resolution. DAC 1.15 Improved Resolution ◊ By increasing the binary number size by one bit the voltage between steps decreases. 4-bit resolution 5-bit resolution DAC 1.16 Percentage Resolution ◊ Resolution can be expressed as the percentage of the Full Scale Output. % Re solution ◊ 4-bit example: ◊ 5-bit example: Step _ Size 1 1 n VFS # Steps (2 1) % Re solution % Re solution 0.5V 1 6.67 % 7.5V 15 0.25V 1 3.22 % 7.75V 31 DAC 1.17 Bipolar DAC ◊ The examples shown so far represented positive output voltage values. Analog values can also be negative. ◊ To represent a negative value a signed 2’s compliment is used. DAC 1.18 Signed Magnitude ◊ Binary systems utilize only 1’s and 0’s. The negative symbol cannot be used. ◊ In a signed magnitude value, the bit in the leftmost position of a binary number is used to indicate if the value is positive or negative. This is the sign bit. The value following the sign bit is the magnitude. 01001101 = positive value, 10011012 11001101 = negative value, 10011012 The leftmost bit is the sign bit. DAC 1.19 Signed Magnitude ◊ The signed magnitude is difficult for digital devices to utilize. Digital systems are designed to add values together. ◊ Another system is used instead: 2’s compliment. Sign Bit: 0 is positive 1 is negative DAC 1.20 1’s Compliment ◊ The 1’s compliment simply means taking the compliment of each binary bit in a binary number. 10110 : Original Number 01001 : One’s Compliment DAC 1.21 2’s Compliment ◊ The 2’s compliment simply means taking the compliment of each binary bit in a binary number and adding a 1 to the LSB. This is considered the equivalent of a negative number for purposes of addition. 10110 : Original Number 01001 : One’s Compliment 00001 : Add a 1 01010 : 2’s Compliment DAC 1.22 2’s Compliment Example using 2’s compliment: Represent the following operation in binary: 1100 is 12 12 -3 9 0011 is 3 1100 is 1’s compliment 1101 is 2’s compliment 1100 (12) +1101 (-3) 11001 (9) Note the extra bit is always disregarded DAC 1.23 2’s Compliment Example 13 -10 3 1101 is 13 1010 is “10” 0101 is 1’s compliment 0110 is 2’s compliment 1101 (13) +0110 (-10) 10011 (3) DAC 1.24 Signed 2’s Compliment Example 13 -10 3 01101 is 13 (signed 2’s compliment) 01010 is “10” 10101 is 1’s compliment 10110 is 2’s compliment 01101 (+13) + 10110 (-10) 100011 (+3) Sign bit DAC 1.25 Signed 2’s Compliment Example 10 -13 -3 Sign bit 01010 is 10 (signed 2’s compliment) 11101 is “-13” 10010 is 1’s compliment 10011 is 2’s compliment 01010 (+10) + 10011 (-13) 11101 (-3, in 2’s compliment) 11101 is “-3” in 2’s compliment 10010 is 1’s compliment 10011 is -3 DAC 1.26 Exercise 1. Determine the decimal values of the following signed binary numbers: a) 01001 b) 10001 c) 10101 2. Determine the decimal values of the following signed, 2’s compliment binary numbers: a) 01001 b) 10001 c) 10101 DAC 1.27 Exercise (continued) 3. What is the range of signed decimal values in 1 byte of data, and what is the most negative value in a signed byte? 4. What is the most negative value in a signed, 2’s compliment byte? DAC 1.28 Answers 1. a: +9, b: -1, c: -5 These values are not 2’s compliment, so what follows the sign is magnitude 2. a: +9, b: -15, c: -11 3. 0111 1111 (most positive, +127) to 1000 000 (most negative, -128) 4. -128 (1000 000). This is an unusual exception as the 2’s compliment equals the magnitude, but is valid. DAC 1.29 Bipolar DAC ◊ If structured accordingly, DACs can produce negative and positive output voltages. Value Signed 2’s Compl. DAC input VOUT Most + 0111 1111 1111 1111 +VMAX Zero 0000 0000 1000 0000 0V Most - 1000 0000 0000 0000 -VMAX ◊ Some DACs will accept a signed, 2’s compliment value, but this would be specified. DAC 1.30 Review Questions ◊ An 8-bit DAC has an input of 0100 1001 and produces an output of 2.19 Volts. 1. 2. 3. 4. What What What What is the voltage resolution? is the FSO? are the input weights of the bits? is the percent resolution? 1001001 = 73 > 2.19/73=0.03V/bit 1111 1111 = FSO =>255*0.03=7.65V 1st=0.03v, 2nd=0.06, 3=0.12, 4=0.24, 5=0.48, 6=0.96, 7=1.92, 8=3.84 1/(28-1)=1/255=0.392% DAC 1.31 Review Questions 2 ◊ An 6-bit DAC has an input of 010 111 and produces an output of 172.5 mV. 1. 2. 3. 4. What What What What is the voltage resolution? is the FSO? are the input weights of the bits? is the percent resolution? 010111 = 23 => 172.5m/23= 7.5mV/bit 111 111 = FSO =>*0.03=472.5mV 1st=7.5v, 2nd=15, 3=30, 4=60, 5=120, 6=240mV (verify 120+30+15+7.5=172.5mV) 1/(26-1)=1/63=1.59% DAC 1.32 End of Part 1 ©Paul R. Godin prgodin°@ gmail.com DAC 1.33