100% found this document useful (2 votes)
1K views

LPC2148 Dac

This document discusses generating waveforms using the digital-to-analog converter (DAC) on the LPC2148 microcontroller. It provides details on the DAC module, including the DAC register used to set the output value. A program is shown that generates a sine wave by updating the DAC register with values corresponding to the sine function. Methods for generating triangular and trapezoidal waves using a similar approach of incrementing or decrementing the DAC output are also described.

Uploaded by

Smruti Pore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
1K views

LPC2148 Dac

This document discusses generating waveforms using the digital-to-analog converter (DAC) on the LPC2148 microcontroller. It provides details on the DAC module, including the DAC register used to set the output value. A program is shown that generates a sine wave by updating the DAC register with values corresponding to the sine function. Methods for generating triangular and trapezoidal waves using a similar approach of incrementing or decrementing the DAC output are also described.

Uploaded by

Smruti Pore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

LPC2148-DAC

Mrs. S. A. Pore
Assistant Professor
Electronics Department
DKTES’ TEI, Ichalkaranji
Objectives
• Understand working of DAC.
• Write and execute program to generate sine wave using DAC.
• Discuss logic to generate different waveforms using DAC.
Introduction
• ARM7 LPC2148 MCU incorporates a 10 bit DAC and provides buffered
analog output
• LPC2148 DAC has only 1 output pin, referred to as AOUT.
• The Analog voltage at the output of this pin is given as:
VAOUT = (VALUE * VREF)/ 1024
• VALUE = 10-bit digital value
• VREF = Input reference voltage
• VAOUT = Output of DAC
Pins related to LPC2148 DAC
Sr. No. Pin Description
1 AOUT (P0.25) Analog Output pin. Provides the converted Analog signal which is referenced to VSSA
i.e. the Analog GND. Set Bits[19:18] in PINSEL1 register to [10] to enable this function.
2 VREF This is the voltage reference pin used by DAC for conversion.
3 VDDA, VSSA VDDA is Analog Power pin and VSSA is Ground pin used to power the DAC module.
These are generally same as VCC and GND but with additional filtering to reduce
noise.
DACR (DAC Register)
• DACR is a 32-bit register. 31 17 16 15 6 5 0

• It is a read-write register. Reserved BIAS Value Reserved

• Bit 5:0 – RESERVED


• Bits 15:6 – VALUE This field contains the 10-bit digital value that is to be
converted in to Analog voltage. We can get Analog output voltage on AOUT
pin and it is calculated with the formula (VALUE/1024) * VREF.
• Bit 16 – BIAS 0 = Maximum settling time of 1µsec and maximum current is
700µA 1 = Settling time of 2.5µsec and maximum current is 350µA
• Note that, the settling times are valid for a capacitance load on the AOUT
pin not exceeding 100 pF. A load impedance value greater than that value
will cause settling time longer than the specified time.
Sine wave generation
• • Its 10 bit DAC.
• Therefore range of analog values is 2^n=210=1024
• V=A sinωt + C
• A = C = 500
• ωt = ϴ = 0 to 360
• Let ϴ=90 ⸫ V=(500*sin90) + 500 = 1000
• Hence V = {500, 599, 695, 782, 859, 921, 966, 993, 1000, 987, 955,
904, 838, 758, 667, 571, 471, 372, 279, 194, 122, 64, 24, 3, 2, 20, 58,
114, 184, 268, 360, 458}
Program
# include <LPC214X.H>
unsigned int a[]={500, 599, 695, 782, 859, 921, 966, 993, 999, 987,
955, 904, 838, 758, 667, 571, 471, 372, 279, 194, 122, 64, 24, 3, 2, 20,
58, 114, 184, 268, 360, 458};
void delay()
{
unsigned int i;
for(i=0;i<1000;i++);
}
Program continued…
int main()
{
unsigned int i;
PINSEL1=0x80000;
IODIR0=0x020000F0;
Program continued…
while(1)
{
for(i=0;i<32;i++)
{
DACR = a[i]<<6;
delay();
}
}
}
DAC Connection Diagram
DAC output
Triangular Wave Generation
while(1)
{
for(i=0;i<1000;i++)
{
DACR = i<<6;
}
for(i=1000;i<0;i--)
{
DACR = i<<6;
}
}
Trapezoidal Wave Generation
while(1)
{
for(i=0;i<1000;i++)
{
DACR = i<<6;
}
delay(); delay();delay(); delay();
for(i=1000;i<0;i--)
{
DACR = i<<6;
}
delay(); delay();delay(); delay();
}

You might also like