Setup Development Environment:: DAC AIM
Setup Development Environment:: DAC AIM
AIM
To generate the continuous sinusoidal waveform, square waveform and Triangular waveform
using the DAC (Digital-to-Analog Converter) of the LPC2148 microcontroller and visualize the output
using Proteus software.
Apparatus Required
Keil µversion4
Proteus software
Procedure
Add the LPC213x.h header file and include the math library.
Set the target device to LPC2148 in your project settings.
Simulate in Proteus:
int main(){
int value=0x3ff;
PINSEL1 = 0X00080000;
while(1){
value = 512+400*sin(t*0.01745);
DACR = value<<6;
if(++t==360)t=0;
}
}
Output
int main(){
int value = 0x3ff;
PINSEL1 = 0X00080000;
while(1){
if (t < 180) {
value = 512 + 400;
} else {
value = 512 - 400;
}
DACR = value << 6;
if (++t == 360) t = 0;
}
}
Output
value += 512;
DACR = value << 6;
if (++t == 360) t = 0;
}
}
Output
Result
Thus the continuous sinusoidal waveform, square waveform and Triangular waveform using the
DAC (Digital-to-Analog Converter) of the LPC2148 microcontroller was simulated and visualized the
output using Proteus software.