Exp6 Report

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

12/09/2022 R Meghana

20BEC1042

EXPERIMENT 6
SINE WAVE GENERATION USING CCS

Aim:
 To generate a sine wave using code composer studio (CCS)
 To generate two sine waves of two different frequencies using CCS
 To generate a sine and a cosine wave of 2 different frequencies and add
them using CCS

Software Required: Code composer studio (CCS)

Program code:
 Generation of a sine wave
#include<stdio.h>
#include<math.h>

#define FREQ 500


float m[127];
void main()
{
int i=0;
for(i=0;i<127;i++)
{
m[i]=sin(2*3.14*FREQ1*i/24000);
printf("%f\n",m[i]);
}
}

 Generation of 2 sine waves


#include<stdio.h>
#include<math.h>

#define FREQ1 500

ECE2006-Digital Signal Processing Lab


L31+L32
12/09/2022 R Meghana
20BEC1042

#define FREQ2 1000


float m[127];
float n[127];
void main()
{
int i=0;
for(i=0;i<127;i++)
{
m[i]=sin(2*3.14*FREQ1*i/24000);
n[i]=sin(2*3.14*FREQ2*i/24000);
printf("%f\n",m[i]);
printf(“%f\n”,n[i]);
}
}

 Generation of a sine and a cosine wave


#include<stdio.h>
#include<math.h>

#define FREQ1 500


#define FREQ2 1500
float m[127];
float n[127];
float p[127];
void main()
{
int i=0;
for(i=0;i<127;i++)
{
m[i]=sin(2*3.14*FREQ1*i/24000);
n[i]=cos(2*3.14*FREQ2*i/24000);
p[i]=m[i]+n[i];
printf("%f\n",m[i]);
printf("%f\n",n[i]);
printf("%f\n",p[i]);
}
}

ECE2006-Digital Signal Processing Lab


L31+L32
12/09/2022 R Meghana
20BEC1042

Output:
 Generation of a sine wave

ECE2006-Digital Signal Processing Lab


L31+L32
12/09/2022 R Meghana
20BEC1042

 Generation of 2 sine waves

ECE2006-Digital Signal Processing Lab


L31+L32
12/09/2022 R Meghana
20BEC1042

 Generation and addition of a sine and a cosine wave

ECE2006-Digital Signal Processing Lab


L31+L32
12/09/2022 R Meghana
20BEC1042

Result: We have thus generated the required signals using code composer
studio (CCS), and have observed the same.

Output verification:

ECE2006-Digital Signal Processing Lab


L31+L32
12/09/2022 R Meghana
20BEC1042

ECE2006-Digital Signal Processing Lab


L31+L32

You might also like