Tuesday, August 30, 2022

DAC interface with ARM7 LPC 2148 : Sine wave generation

 


PROGRAM LOGIC:

* Equation for generating sine wave is created.

* Program loop is created to send Sine wave value (0 to 360 radian ) to DAC

* DAC convert digital equivalent value of sine wave into analog signal

* CRO is connected in DAC output pin (P0.25) to display sine wave.



PROGRAM CODE

#include <lpc214x.h>

#include <stdio.h>

#include <math.h>

#define Rad 0.0174532925

int teta,DAC_In;

float sine_val;

int main()

{

PINSEL1 = 0X00080000;

while(1)

{

for(teta=0;teta<360;teta++)

{

sine_val = (1.65 * sin(teta*Rad));

DAC_In = ((sine_val * 1024 /3.3)+512);

DACR = (DAC_In<<6);

}

}

}


CIRCUIT DIAGRAM





No comments:

Post a Comment

GPS sensor interface with ESP8266 using Blynk IoT cloud

   Circuit diagram: Source Code: #include <TinyGPS++.h> #include <SoftwareSerial.h> #define BLYNK_PRINT Serial #include <ESP8...