0% found this document useful (0 votes)
3 views

dspfolder

The document outlines a series of experiments conducted on the TMS320C6748 DSP processor using Code Composer Studio, focusing on various operations such as 32-bit addition, multiplication, sine wave generation, linear and circular convolution, and the computation of the Discrete Fourier Transform (DFT). Each experiment includes a theoretical background, C programming code, input and output examples, and procedural steps for implementation. The results demonstrate successful execution of the operations on the DSP processor.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

dspfolder

The document outlines a series of experiments conducted on the TMS320C6748 DSP processor using Code Composer Studio, focusing on various operations such as 32-bit addition, multiplication, sine wave generation, linear and circular convolution, and the computation of the Discrete Fourier Transform (DFT). Each experiment includes a theoretical background, C programming code, input and output examples, and procedural steps for implementation. The results demonstrate successful execution of the operations on the DSP processor.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

EXPERIMENT 01

1.A)

Aim: To perform 32-bit addi on opera on on TMS32006748 using CCS.


So ware used: Code Composer Studio
Components used: TMS320C6748 Processor Kit
Theory:
A 32-bit register can store 2^32 different values. The range integer valves that can be stored
in 32 bits depends on the integer representa on used. With The two most common
representa ons, the range is 0 through 4,294, 967, 295 (2^32-1) for representa on as an
(unsigned) binary number, and -2147, 483,648 (-2^31) through 2,197, A83,647 (2^32-1) for
representa on as Two's complement. We use types of uint32_t and use the %u format
specifier to print.

C Program for Addi on:


#include<stdio.h>
#include<math.h>
int main(){
int a,b,c;
a=0x12DE01AB;
b=0x340A1CDA;
c=a+b;
prin ("c=%d\n",c);
prin ("c=%x\n",c);
return 0;
}

Input:
a=0x12DE01AB;
b=0x340A1CDA;
Output:
c=1189617285
c=46e81e85

Procedure:
1.) Connect TMS320C6748 DSP processor to the system with the required wires.
2.) Create a new CCS project, for crea ng a new project (File > New > CCS project)
3.) Select Processor type TMS320C6748 and then select "Empty Project(main.c)" and then
click on finish op on.
4.) Main.c file opens and here need to write the code for addi on opera on.

5.) Next, to get the output from the code we need to first debug the code by clicking on the
debug op on a er debugging we need to build the project as last step.
6.) A er we finish building the project then we need to run the project to get the final
output of the program.
7.) Output answer will be displayed in the console window.

Result:
The 32-bit addi on opera on on TMS320C6748 DSP processor is performed and the result is
been obtained and displayed.
1.B)
Aim: To perform 32-bit mul plica on opera on on TMS32006748 using CCS.
So ware used: Code Composer Studio
Components used: TMS320C6748 Processor Kit
Theory:
The 32-bit data registers are used for arithme c logical and other opera ons. It can store
2^32 values and it can be stored in 32 bits depends on the integer representa on used. i.e
4GB of RAM or physical memory ideally it can access more than 4GB of RAM also. In 32-bit
mul plica on the result raise to 32 mul plied by 2 raised to 32 is equal to 2 raised to 64.
When you mul ply two integers together the result is an integer twice as long. 32 bits x 32
bits = 64 bits of result. The main idea is to split a 32bit unsigned value into two parts: the
upper 16 bits (value with base 216) and the lower 16 bits.

C Program for Mul plica on:


#include<stdio.h>

#include<math.h>
int main(void)
{
long a=0x12345678;
long b=0x98765432;
long c=a*b;
prin ("mul":%x",c);
return 0;
}

Input: a=0x12345678
b=0x98765432

Output: mul:d5e84370
Procedure:
1.) Connect TMS320C6748 DSP processor to the system with the required wires.
2.) Create a new CCS project, for crea ng a new project (File > New > CCS project)
3.) Select Processor type TMS320C6748 and then select "Empty Project(main.c)" and then
click on finish op on.
4.) Main.c file opens and here need to write the code for addi on opera on.
5.) Next, to get the output from the code we need to first debug the code by clicking on the
debug op on a er debugging we need to build the project as last step.
6.) A er we finish building the project then we need to run the project to get the final
output of the program.
7.) Output answer will be displayed in the console window.

Result:
The 32-bit mul plica on opera on on TMS320C6748 DSP processor is performed and the
result is been obtained and displayed.
1.C)
Aim To generate the sine wave using TM320C6748 processor.
So ware used: Code Composer Studio
Components used: TMS320C6748 Processor Kit
Theory:
A sine wave, sinusoidal wave, or just sinusoid is a mathema cal curve defined in terms of
the since trigonometric func on. Sine wave creates a sine wave object that generates a real -
valued sinusoid with an amplitude of 1, a frequency of 100Hz, and a phase offset of 0. By
default, the sine wave object generates only one sample.
The simplest method to generate Sine wave is to use Trigonometric Sin func on. The Sin
func on will generate the samples from our specific parameter like sampling frequency,
number of samples, input frequency. In this project, genera ng the correct sample is
important. The library func on "sin()" does all of the work.
Its most basic form as a func on of me (t) is: where:
A, the amplitude, is the peak devia on of the func on from its centre posi on,
W, the angular frequency, specifies how many oscilla ons occur in a unit me interval, in
radians per second
The phase, specifies where in its cycle the oscilla on begins at t = 0.

C Program for Sine Wave genera on:


#include<stdio.h>
#include<math.h>
float a[100],b[100],c[100];
int main(void)
{
int i;
for (i=0;i<100;i++)
{
a[i]=sin(2*3.14*5*i/100);
prin ("%f\n",a[i]);
}
return 0;
}

Procedure:
1.) Connect TMS320C6748 DSP processor to the system with the required wires.
2.) Create a new CCS project, for crea ng a new project (File > New > CCS project)
3.) Select Processor type TMS320C6748 and then select "Empty Project(main.c)" and then
click on finish op on.
4.) Main.c file opens and here need to write the code for mul plica on opera on.
5.) Next, to get the output from the code we need to first debug the code by clicking on the
debug op on a er debugging we need to build the project as last step.
6.) A er we finish building the project then we need to run the project to get the values for
plot.
7.) Next go to (Tools > Graph> Single me) and then keep the DSP Data type as 32 bit floa ng
point and start address "a" and click Ok.
8.) Sine Wave Graph will be obtained.

Screenshots:

Result:
Generated the sine wave using TMS320C6748 processor using CCS.
EXPERIMENT 02
2.A)
Aim: To perform linear convolu on of given discrete me sequences on TMS320C6748
using CCS.

So ware used: Code Composer Studio


Components used: TMS320C6748 Processor Kit
Theory:
Linear convolu on is a process used to combine two signals to produce a new signal that
shows how one signal modifies or affects the other. For discrete signals, convolu on is
calculated by mul plying one signal with a shi ed version of the other and summing the
results. The order of signals doesn’t ma er, as switching them gives the same outcome.
Convolu on can be applied to both con nuous and discrete signals. In systems, it helps
determine how an input signal is altered by the system's behaviour, known as the impulse
response. It operates directly on the me signals, making it essen al for understanding
signal changes over me. The process involves sliding one signal over the other, mul plying
the overlapping sec ons, and summing them to produce the output. Linear convolu on is
commonly used in fields like audio and image processing, filtering, and communica on
systems. Though it can be computa onally intensive for large signals, faster methods like the
Fast Fourier Transform (FFT) can be used to speed up the calcula ons. Visually, convolu on
can be thought of as dragging one signal over the other and calcula ng their combined
effect at each step.

Program for Linear Convolu on:


#include<stdio.h>
#include<math.h>
void linear_conv(int* x,int* h,int* y,int n,int m)
{
int i,j;
int length=n+m-1;
for (i=0;i<length;i++)
{
y[i]=0;
}

for (i=0;i<n;i++)
{
for (j=0;j<m;j++)

{
y[i+j]+=x[i]*h[j];
}
}
}
int main()
{
int i;
int x[]={1,2,3,4};
int h[]={1,2,3};
int n=sizeof(x);
int m=sizeof(h);
int length=n+m-1;
int y[length];
linear_conv(x,h,y,n,m);
prin ("Linear convolu on result :\n");
for (i=0;i<length;i++)
{
prin ("y[%d]=%d ",i,y[i]);
}
return 0;
}

Input:
x={1,2,3,4};
h={1,2,3};

Output:
y[0]=1 y[1]=4 y[2]=10 y[3]=16 y[4]=17 y[5]=12
Procedure:
1.) Connect TMS320C6748 DSP processor to the system with the required wires.
2.) Create a new CCS project, for crea ng a new project (File > New > CCS project)
3.) Select Processor type TMS320C6748 and then select "Empty Project(main.c)" and then
click on finish op on.
4.) Main.c file opens and here need to write the code for circular convolu on.
5.) Next, to get the output from the code we need to first debug the code by clicking on the
debug op on a er debugging we need to build the project as last step.
6.) A er we finish building the project then we need to run the project to get the values for
plot.
7.) Next go to (Tools > Graph> Single me) and then keep the DSP Data type as 32 bit floa ng
point and start address "a" and click Ok.
8.) Graph will be obtained.

Screenshots:

Result:
Performed Linear convolu on of the given discrete me sequences on the DSP
Processor TMS320C6748.
2.B)
Aim: To perform circular convolu on of given discrete me sequences on TMS320C6748
using CCS.

So ware used: Code Composer Studio


Components used: TMS320C6748 Processor Kit
Theory:
Convolu on is a mathema cal opera on on two func ons (f and g) that produces a third
func on () that expresses how the shape of one is modified by the other. The term
convolu on refers to both the result func on and to the process of compu ng it. Steps for
cyclic convolu on are the same as usual convolu on, except all index calcula ons are done
"modN" "on the wheel.
Circular convolu on, also known as cyclic convolu on, is a special case of periodic
convolu on, which is the convolu on of two periodic func ons that have the same period.
Periodic convolu on arises, for example, in the context of the discrete- me Fourier
transform (DTFT). For the circular convolu on of x and y to be equivalent, you must pad the
vectors with zeros to length at least N + L-1 before you take the DFT. A er you invert the
product of the DFTs, retain only the first N + L - 1 elements.
y[n] = f[n]h[n]
And each DTFT is a periodic summa on of a con nuous Fourier transform func on.
Although DTFTs are usually con nuous func ons of frequency, the concepts of periodic and
circular convolu on are also directly applicable to discrete sequences of data. In that
context, circular convolu on plays an important role in maximising the efficiency of a certain
kind of common filtering opera on.
Generally, there are two methods, which are adopted to perform circular convolu on and
they are
1.) Concentric circle method
2.)Matrix mul plica on method
Circular convolu on is used to convolve two discrete Fourier transform (DFT) sequences,
circular convolu on is an opera on on any sequences. whether me or DFT of something
else. Convolu on is an opera on that takes an input signal and returns an output signal
based on knowledge about the system's unit impulse response h[n]. Circular Convolu on is
defined for periodic sequences, whereas
convolu on is defined for aperiodic sequences. The circular convolu on of two N-point
periodic sequences x(n) and y(n) is the N-point sequence a(m) = x(n)* y(n).
C Program for Circular Convolu on:
#include<stdio.h>
#include<math.h>
int N=4;
int x[]={2,1,2,1};
int h[]={1,2,3,4};
int y[4];
void circular_convolu on(int*x,int*h,int*y,int N){
int i,j;
for (i=0;i<N;i++)
{
y[i]=0;
}
for (i=0;i<N;i++)
{
for (j=0;j<N;j++)
{
int k=(i-j+N)%N;
y[i]+=x[j]*h[k];
}
}
}
int main(){
circular_convolu on(x,h,y,N);
prin ("circular convolu on output:\n");
int i;
for(i=0;i<N;i++){
prin ("%d\n",y[i]);
}
return 0;
}

Input:
x={2,1,2,1};
h={1,2,3,4};

Output:
14 16 14 16

Procedure:
1.) Connect TMS320C6748 DSP processor to the system with the required wires.
2.) Create a new CCS project, for crea ng a new project (File > New > CCS project)
3.) Select Processor type TMS320C6748 and then select "Empty Project(main.c)" and then
click on finish op on.
4.) Main.c file opens and here need to write the code for circular convolu on.
5.) Next, to get the output from the code we need to first debug the code by clicking on the
debug op on a er debugging we need to build the project as last step.
6.) A er we finish building the project then we need to run the project to get the values for
plot.
7.) Next go to (Tools > Graph> Single me) and then keep the DSP Data type as 32 bit floa ng
point and start address "a" and click Ok.
8.) Graph will be obtained.

Screenshots:
Result:
Performed Circular convolu on of the given discrete me sequences on the DSP
Processor TMS320C6748.
EXPERIMENT 03
3.A)
Aim: To compute Discrete Fourier Transform (DFT) of given discrete me sequence on
TMS320C6748 using CCS.

So ware used: Code Composer Studio


Components used: TMS320C6748 Processor Kit
Theory:
Fourier analysis describes the transforma ons between me and frequency domain
representa ons of signals. Four different forms of Fourier transforma ons (the Fourier
transform (FT), the Fourier series (FS), the discrete- me Fourier transform (DTFT) and the
discrete Fourier transform (DFT)) are applicable to different classes of signals according to
whether they are discrete or con nuous and whether they are periodic and aperiodic.
The DFT is the form of Fourier transform analysis applicable to signals that are discrete and
periodic in both domain ( me and frequency). Thus, it transforms a discrete, periodic me
domain sequence into a discrete, periodic frequency domain representa on. A periodic
signal may be characterised en rely by just one cycle. If that signal is discrete, then one cycle
comprises a finite number of samples. Therefore, both forward and inverse DFTs are
described by finite summa ons as opposed to infinite summa ons or integrals. This is very
important in digital signal processing since it means that is prac cal to compute the DFT
using a digital signal processor, or digital hardware.
The Discrete Fourier transform (DFT) converts a finite sequence of equally-spaced samples of
a func on into a same-length sequence of equally-spaced samples of the discrete- me
Fourier transform (DTFT), which is a complex-valued func on of frequency

C Program for DFT of given signal:


#include <math.h>
#include <stdio.h>
// Func on to calculate the DFT
float Xi[6],Y[6],amp[6];
int main()
{
prin ("%d\n",123);
int xn[6] = {1,2,3,4,5,6};
prin ("%d\n",123);
int len = 6;
float Xr[6];

int k, n, N;
float M_PI = 3.14;
prin ("%d\n",1234);
N = 4;

for (k = 0; k < N; k++) {


Xr[k] = 0;
Xi[k] = 0;
for (n = 0; n < len; n++) {
Xr[k]
= (Xr[k]
+ xn[n] * cos(2 * 3.141592 * k * n / N));
Xi[k]
= (Xi[k]
- xn[n] * sin(2 * 3.141592 * k * n / N));
Y[k] = atan(Xi[k]/Xr[k]);
Y[k] = Y[k]*(180.0/M_PI);
amp[k] = sqrt(Xi[k]*Xi[k]+Xr[k]*Xr[k]);
}
prin ("(%f) + j(%f)\n", Xr[k], Xi[k]);
prin ("(%f) * (%f)\n",amp[k],Y[k]);
}
return 0;
}

Input:
N = 4;
X = {1,2,3,4,5,6}
Output:
(21.000000) + j(0.000000)
(21.000000) * (0.000000)
(3.000006) + j(-3.999995)
(5.000000) * (-53.156960)
(-3.000000) + j(-0.000012)
(3.000000) * (0.000225)
(2.999980) + j(4.000014)
(4.999999) * (53.157322)

Procedure:
1.) Connect TMS320C6748 DSP processor to the system with the required wires.
2.) Create a new CCS project, for crea ng a new project (File > New > CCS project)
3.) Select Processor type TMS320C6748 and then select "Empty Project(main.c)" and then
click on finish op on.
4.) Main.c file opens and here need to write the code for DFT of given discrete me
sequence.
5.) Next, to get the output from the code we need to first debug the code by clicking on the
debug op on a er debugging we need to build the project as last step.
6.) A er we finish building the project then we need to run the project to get the values for
plot.
7.) Next go to (Tools > Graph> Single me) and then keep the DSP Data type as 32-bit
floa ng point and keep start address as amp > buffer [50] and change line to bar and click
Ok.
8.) Graph will be obtained.
Screenshots:

Result:
The Discrete Time Fourier Transform of given signal is performed on DSP processor and
output is displayed
B)
Aim: To compute Discrete Fourier Transform (DFT) Of given Sinusoidal signal on DSP
processor or using CCS.

So ware used: Code Composer Studio


Components used: TMS320C6748 Processor Kit
C Program for DFT of sinusoidal signal:
#include<stdio.h>
#include<math.h>
float xn[100],b[100],c[100];
float Xr[120],Xi[120],Y[120],amp[120];
int len = 100;
int main(void)
{
int i;
for (i=0;i<100;i++)
{
xn[i]=sin(2*3.14*5*i/100);
}
int k, n, N;
float M_PI = 3.14;
N = 16;
for (k = 0; k < N; k++) {

Xr[k] = 0;
Xi[k] = 0;
for (n = 0; n < len; n++) {
Xr[k] = (Xr[k] + xn[n] * cos(2 * 3.141592 * k * n / N));
Xi[k] = (Xi[k] - xn[n] * sin(2 * 3.141592 * k * n / N));
Y[k] = atan(Xi[k]/Xr[k]);
Y[k] = Y[k]*(180.0/M_PI);
amp[k] = sqrt(Xi[k]*Xi[k]+Xr[k]*Xr[k]);
}

prin ("(%f) + j(%f)\n", Xr[k], Xi[k]);


prin ("(%f) * (%f)\n",amp[k],Y[k]);
}
return 0;
}

Input:
N = 16

Output:
(0.008364) + j(0.000000)
(0.008364) * (0.000000)
(-5.784098) + j(-5.679466)
(8.106301) * (44.499611)
(-1.273731) + j(0.023066)
(1.273940) * (-1.037984)
(-0.258751) + j(0.279616)
(0.380969) * (-47.243336)
(0.007943) + j(-0.008366)
(0.011536) * (-46.512207)
(-0.121295) + j(-0.123734)
(0.173270) * (45.593250)
(-0.194215) + j(0.003391)
(0.194245) * (-1.000654)
(-0.080745) + j(0.090318)
(0.121149) * (-48.227493)
(0.007953) + j(0.000006)
(0.007953) * (0.041017)
(-0.080733) + j(-0.090317)
(0.121140) * (48.231579)
(-0.194215) + j(-0.003404)

(0.194245) * (1.004559)
(-0.121311) + j(0.123733)
(0.173281) * (-45.589252)
(0.007942) + j(0.008389)
(0.011552) * (46.592319)

Procedure:
1.) Connect TMS320C6748 DSP processor to the system with the required wires.
2.) Create a new CCS project, for crea ng a new project (File > New > CCS project)
3.) Select Processor type TMS320C6748 and then select "Empty Project(main.c)" and then
click on finish op on.
4.) Main.c file opens and here need to write the code for DFT of given discrete me
sequence.
5.) Next, to get the output from the code we need to first debug the code by clicking on the
debug op on a er debugging we need to build the project as last step.
6.) A er we finish building the project then we need to run the project to get the values for
plot.
7.) Next go to (Tools > Graph> Single me) and then keep the DSP Data type as 32-bit
floa ng point and keep start address as amp > buffer [50] and change line to bar and click
Ok.
8.) Graph will be obtained.
Screenshots:

Result:
The Discrete Time Fourier Transform of given sinusoidal signal is performed on DSP
processor and output is displayed

You might also like