Lecture 10 DAC
Lecture 10 DAC
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
DAC
0.50V (0b00011001)
0.81V (0b00101001)
1.25V (0b00111111) 2
…
Digital to Analog Conversion
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
6
DAC Resolution
Vref
7
0V
DAC Resolution
Vref
8
0V
Buffered Binary Resistor Network DAC
R Rf
MSB
2R
-
4R +
8R
LSB
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𝑅𝑅 𝑅𝑅
𝑽𝑽𝑽𝑽𝑽𝑽
Vout = Vref x
𝟐𝟐𝑵𝑵 13
R-2R Resistor Ladder DAC
I R R R
Vs 2R 2R 2R 2R 2R
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
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)
27