0% found this document useful (0 votes)
19 views

Lecture 10 DAC

Intro to micro electronics lecture slides

Uploaded by

serget1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Lecture 10 DAC

Intro to micro electronics lecture slides

Uploaded by

serget1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

The University of Texas at Arlington

Lecture 10
DAC: Digital-to-Analog Conversion

CSE 3442/5442
Embedded Systems 1
Based heavily on slides by Dr. Gergely Záruba and Dr. Roger Walker
Digital to Analog Conversion

• Unlike an ADC, a DAC takes a digital value and


converts it into a quasi-analog voltage
• Usually the conversion is linear
– Equal step size
• PIC18s have no built-in DACs (use standalone ICs)
• A DAC can have a parallel input or a serial input

DAC
0.50V (0b00011001)
0.81V (0b00101001)
1.25V (0b00111111) 2

Digital to Analog Conversion

• Unlike an ADC, a DAC takes a digital value and


converts it into a quasi-analog voltage
• Usually the conversion is linear
– Equal step size
• PIC18s have no built-in DACs (use standalone ICs)
• A DAC can have a parallel input or a serial input
Output Range: 0V – Vref
Example: 0.0V – 5.0V

8-bit Example DAC


Input Range: 0 – 255 decimal

3
Reconstructing a Signal
Img Source: http://www.nutaq.com/

Digital

~Analog

4
Example

Sensor Actuator
(Input) (Output)
|------------ANALOG---------------|-----------DIGITAL-------------|-----------------ANALOG----------------|

5
Img Source: https://commons.wikimedia.org/wiki/File:CPT-Sound-ADC-DAC.svg
Applications

• ADC (sensor input) • DAC (actuator output)


– Audio (microphone) – Audio (speaker)
– Temperature – Motor Speed
– Weight/Force – Valve
– Light – Cooling System
– Electricity – Light
– Air Pressure – Video (some)
– Water Flow Rate – Fuel Injector

6
DAC Resolution

• Similar to an ADC’s resolution


• More bits (inputs) == More precise output
• Most are 8, 10, or 12 bits
8: 256 discrete voltage levels for output
10: 1024 discrete voltage levels for output
12: 4096 discrete voltage levels for output

Vref

7
0V
DAC Resolution

• Similar to an ADC’s resolution


• More bits (inputs) == More precise output
• Most are 8, 10, or 12 bits
8: 256 discrete voltage levels for output
10: 1024 discrete voltage levels for output
12: 4096 discrete voltage levels for output

Vref

256 1024 4096

8
0V
Buffered Binary Resistor Network DAC

R Rf
MSB
2R
-

4R +

8R
LSB

• Seldom used when more than 6 bits


• Consider the design of an 8-bit DAC if the smallest resistor has resistance R
– what would be the value of the largest resistor?
– what would be the tolerance of the smallest resistor?
– input resistors could load the output differently
• Very difficult to manufacture very accurate resistors over this range
9
R-2R Resistor Ladder DAC

10
R-2R Resistor Ladder DAC
0V / 5V 0V / 5V 0V / 5V 0V / 5V 0V / 5V

Vref = 5V

𝑽𝑽𝑽𝑽𝑽𝑽
Vout = Vref x
𝟐𝟐𝑵𝑵

11
R-2R Resistor Ladder DAC
3-bit Example
0V / 5V 0V / 5V 0V / 5V Nodal Analysis
Vref = 5V Kirchhoff's current law
I1
Iin = Iout per junction
V = IR
V0 V1 V2
I0 I2
For V0: I0 = I1 + I2
𝑉𝑉0 − 0𝑉𝑉 𝑎𝑎0 −𝑉𝑉0 𝑉𝑉1 −𝑉𝑉0
I0 = I1 = I2 =
2𝑅𝑅 2𝑅𝑅 𝑅𝑅

𝑉𝑉 − 0𝑉𝑉 𝑎𝑎 −𝑉𝑉 𝑉𝑉 −𝑉𝑉


 Use 0 = 0 0 + 1 0 and V1, V2 equations
2𝑅𝑅 2𝑅𝑅 𝑅𝑅
12
to solve for V2 (Vout) with only a0, a1, and a2 left
R-2R Resistor Ladder DAC
3-bit Example
0V / 5V 0V / 5V 0V / 5V

Vref = 5V VAL Vout


000 0.0 V
001 0.625 V
010 1.25 V
V0 V1 V2 011 1.875 V
100 2.5 V
Nodal Analysis 101 3.125 V
1 1 1
Vout = 𝑎𝑎0 + 𝑎𝑎1 + 𝑎𝑎2 110 3.75 V
8 4 2 111 4.375 V

𝑽𝑽𝑽𝑽𝑽𝑽
Vout = Vref x
𝟐𝟐𝑵𝑵 13
R-2R Resistor Ladder DAC
I R R R

Vs 2R 2R 2R 2R 2R

I/2 I/4 I/8 I/16

Rf

+
Vo
4-bit register
MSB

LSB

14
DAC on the QwikFlash

15
MAX522

16
DAC on the QwikFlash

MAX522
3-wire serial interface input
Two 8-bit buffered DAC Voltage Outputs

17
DAC on the QwikFlash

MAX522
3-wire serial interface input
Two 8-bit buffered DAC Voltage Outputs

18
MSSP Module
SPI Connections

19
MAX522 DAC

• 3-wire serial Interface


– 𝑪𝑪𝑪𝑪: needs to be kept low when
feeding in data
– Rising edge will modify
behavior of DAC
– SCLK: every rising edge data
is clocked in (<5MHz)
– DIN: Data line
• Each command is 16 bits long
• For PIC interfacing, we can
program it directly or use
serial communication
peripherals

20
MAX522 DAC

21
MSSP Module
SPI Connections

Serial Data
Serial Clock OUT
OUT
22
SPI Mode Registers

23
24
25
Example – MAX522
unsigned char controlByte= 0;
unsigned char dataByte = 0;
SSPSTAT = 0bxxxxxxxx; //SMP and CKE
SSPCON1 = 0bxxxxxxxx; //Enable SPI serial port

while(1)
{
//calculations…, assign value to dataByte (8-bit data you want to send out)
//Enable DAC (Chip Select pin on DAC)

SSPBUF = controlByte; //MAX522 Control bits to select which output to use


while(SSPSTATbits.BF == 0); //wait until transmission is complete

SSPBUF = dataByte; //Assign Voltage value to DAC via buffer


while(SSPSTATbits.BF == 0); //wait until transmission is complete

//Disable DAC (Chip Select pin on DAC)


} 26
Questions?

27

You might also like