digital to analog converters (dac) 1 ©paul godin created march 2008 updated march 2010

33
Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Upload: patrick-fleming

Post on 26-Dec-2015

217 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Digital to Analog Converters (DAC)

1

©Paul GodinCreated March 2008Updated March 2010

Page 2: 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

Page 3: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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

Page 4: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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

Page 5: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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

Page 6: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Analog versus Digital

000000100000010000101000101000011010010011001110101000100000101000101000011010010011001110101000100000001000010100000010000101000101000011010010011001110101000100001010000110100100110011101010001010111011011010001001

Original Analog signal

Distorted Analog signal

Binary signal

A to A

A to D

DAC 1.6

Page 7: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Analog to Digital

Original Analog signal

Binary signal

A to D Conversion

000100110111101010001000111000000100000010011100101001001011101011110010101010010101010101001001010101001000101001010101111010000001001011101011101000000010101110101010000000000001001111010000000000000111111010000000000001010101010000000000001011011101000000000001101101100000000001100010111010000000100011111010110000001001010101000100000001010111101111000000011001101010100101000110111000010100101

The voltage is converted to a binary value at regular intervals.

AnimatedDAC 1.7

Page 8: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Digital to Analog

Digital signal

Analog signalD to A Conversion

000100110111101010001000111000000100000010011100101001001011101011110010101010010101010101001001010101001000101001010101111010000001001011101011101000000010101110101010000000000001001111010000000000000111111010000000000001010101010000000000001011011101000000000001101101100000000001100010111010000000100011111010110000001001010101000100000001010111101111000000011001101010100101000110111000010100101

The binary value is converted to a voltage at regular intervals.

Animated DAC 1.8

Page 9: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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

Page 10: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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

Page 11: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Scale Example

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

DAC

DCBA

MSB

LSB

Min VOUT = 0VMax desired VOUT = 7.5V

VOUT

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.

K)12(

An

FS

Min

bin

ary

= 0

000

Max b

inary

= 1

111

AFS = Analog Full Scale Voltage

DAC 1.11

Page 12: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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

Page 13: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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

Page 14: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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.

◊ 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

10112

20212223

DAC 1.14

Page 15: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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

Page 16: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Improved Resolution

◊ By increasing the binary number size by one bit the voltage between steps decreases.

E D C B A VOUT

0 0 0 0 0 0.00

0 0 0 0 1 0.25

0 0 0 1 0 0.50

0 0 0 1 1 0.750 0 1 0 0 1.00

0 0 1 0 1 1.25

0 0 1 1 0 1.50

0 0 1 1 1 1.75

0 1 0 0 0 2.00

0 1 0 0 1 2.25

0 1 0 1 0 2.500 1 0 1 1 2.75

0 1 1 0 0 3.00

0 1 1 0 1 3.25

0 1 1 1 0 3.50

0 1 1 1 1 3.75

1 0 0 0 0 4.001 0 0 0 1 4.25

1 0 0 1 0 4.50

1 0 0 1 1 4.75

1 0 1 0 0 5.00

1 0 1 0 1 5.25

1 0 1 1 0 5.50

1 0 1 1 1 5.751 1 0 0 0 6.00

1 1 0 0 1 6.25

1 1 0 1 0 6.50

1 1 0 1 1 6.75

1 1 1 0 0 7.00

1 1 1 0 1 7.25

1 1 1 1 0 7.501 1 1 1 1 7.75

4-bit resolution 5-bit resolution

DAC 1.16

Page 17: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Percentage Resolution

◊ Resolution can be expressed as the percentage of the Full Scale Output.

◊ 4-bit example:

◊ 5-bit example:

)12(

1Steps#

1V

Size_StepsolutionRe%

nFS

%67.6151

V5.7V5.0

solutionRe%

%22.3311

V75.7V25.0

solutionRe%

DAC 1.17

Page 18: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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

Page 19: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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

Page 20: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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 positive1 is negative

DAC 1.20

Page 21: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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

Page 22: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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 Compliment00001 : Add a 1

01010 : 2’s Compliment

DAC 1.22

Page 23: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

2’s Compliment

Example using 2’s compliment:Represent the following operation in binary: 12

- 3 9

1100 is 12

0011 is 31100 is 1’s compliment1101 is 2’s compliment

Note the extra bit is always disregarded

DAC 1.23

Page 24: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

2’s Compliment Example

13-10 3

1101 is 13

1010 is “10”0101 is 1’s compliment0110 is 2’s compliment

DAC 1.24

Page 25: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Signed 2’s Compliment Example

13-10 3

01101 is 13 (signed 2’s compliment)

01010 is “10”10101 is 1’s compliment10110 is 2’s compliment

Sign bit

DAC 1.25

Page 26: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Signed 2’s Compliment Example

10-13 -3

01010 is 10 (signed 2’s compliment)

11101 is “-13”10010 is 1’s compliment10011 is 2’s compliment

01010 (+10)+ 10011 (-13) 11101 (-3, in 2’s compliment)

Sign bit

11101 is “-3” in 2’s compliment10010 is 1’s compliment10011 is -3

DAC 1.26

Page 27: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Exercise

1. Determine the decimal values of the following signed binary numbers:a) 01001b) 10001c) 10101

2. Determine the decimal values of the following signed, 2’s compliment binary numbers:a) 01001b) 10001c) 10101

DAC 1.27

Page 28: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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

Page 29: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

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

Page 30: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Bipolar DAC

◊ If structured accordingly, DACs can produce negative and positive output voltages.

◊ Some DACs will accept a signed, 2’s compliment value, but this would be specified.

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

DAC 1.30

Page 31: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Review Questions

◊ An 8-bit DAC has an input of 0100 1001 and produces an output of 2.19 Volts.

1. What is the voltage resolution?2. What is the FSO?3. What are the input weights of the bits?4. What is the percent resolution?

1001001 = 73 > 2.19/73=0.03V/bit1111 1111 = FSO =>255*0.03=7.65V1st=0.03v, 2nd=0.06, 3=0.12, 4=0.24, 5=0.48, 6=0.96, 7=1.92, 8=3.841/(28-1)=1/255=0.392%

DAC 1.31

Page 32: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

Review Questions 2

◊ An 6-bit DAC has an input of 010 111 and produces an output of 172.5 mV.

1. What is the voltage resolution?2. What is the FSO?3. What are the input weights of the bits?4. What is the percent resolution?

010111 = 23 => 172.5m/23= 7.5mV/bit111 111 = FSO =>*0.03=472.5mV1st=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

Page 33: Digital to Analog Converters (DAC) 1 ©Paul Godin Created March 2008 Updated March 2010

©Paul R. Godinprgodin°@ gmail.com

End of Part 1

DAC 1.33