FLOW CHART:
Start
Initialize DAC
0 is output in DAC
Delay
0x0000ff10 is output in DAC
Delay
[Link]:
DATE:
DIGITAL TO ANALOG CONVERSION
AIM:
This project helps to study the on chip peripheral DAC.
DIRECTORY NAME: DAC
The relevant files like DAC.c and vector.s etc are in the directory DAC\ and the compile
output file [Link] is in the directory DAC\debug\.
The DAC.C file is the main file for the project. The vector.s is the startup file. The [Link] is
the linker input file.
FUNCTIONAL DESCRIPTION:
LPC 2148 digital to analog convertor is based on register string architecture. Resolution of the
DAC is 10 bit. DAC output is buffered internally and is available at the port line po.25. Power down
mode is also supported for this DAC unit. Settling time of DAC can be set by initializing the DAC
control register if this bit is 0 settling time of DAC is 1 microsecond and maximum current is
[Link] this bit is 1, the settling time DAC is 2.5 microsecond and the maximum current
is 350 microamps. Voltage reference for the DAC convertor is given through V REF pin.
This pin is connected with3.3 V supply after writing new value in the DAC data register the
voltage on the Aout pin is (value/1024) Vref.
The DAC output is converted to a 5V bugger found on board.
PROGRAM FLOW:
STEP1: Initialize DAC set the port line po.25 to have special function (DAC) using the PINSEL
register.
STEP2: Set the value 0 to DAC. Call a delay.
STEP3: Set the value 0XFF10+[Link] a delay.
STEP4: Repeat from step2.
PROGRAM CODE:
#include "LPC214x.h"
void InitializeDAC(void);
int main (void)
long c;
InitializeDAC(); //Initialize DAC
while(1)
DACR = 0x00; // Set DAC = 0
for(c=0;c<0xf0000;c++); // Delay
DACR = 0x0000ffc0; // Set DAC = (0x3ff << 6)
for(c=0;c<0xf0000;c++); // Delay
void InitializeDAC(void)
PINSEL1 = 0x00080000; // Set P0.25 for DAC output
void __gccmain()
}
Algorithm 10
Flowchart 5
Program 20
Execution/Result 10
Viva 5
Total 50
RESULT:
Thus, the buzzer generated a sound according to the square waveform given to it.