3 Implementation of Discrete Fourier Transform (DFT) for
Various Signals on TMS3206748 Digital Signal Processor
Aim To compute the Discrete Fourier Transform (DFT) of various
signals using a DSP processor or with Code Composer Studio.
Software: Code Composer Studio (CCS)
Hardware Components: TMS320C6748 Processor Kit
PC with Code Composer Studio
Theory
The Discrete Fourier Transform (DFT) is a technique used to
convert a discrete-time signal from the time domain into the
frequency domain. It is commonly used in digital signal
processing (DSP), communication systems, and image
processing for analyzing the frequency components of signals.
The DFT of a discrete sequence x[n]x[n]x[n] is mathematically
represented as:
DFT Techniques
1. Windowing: Applying windows to reduce edge effects.
2. Zero-Padding: Padding the input sequence with zeros to increase
frequency resolution.
3. Circular Shifting: Shifting the input sequence to analyze different
frequency ranges.
Important Points
Frequency Resolution: \(\Delta f = \frac{1}{N}\)
Frequency Bin: Each DFT bin represents a specific frequency
range.
Leakage: Energy leakage can occur between frequency bins.
Procedure
1. Connect the Hardware: Connect the TMS320C6748 DSP
processor to the PC using the required wires.
2. Create a New Project:
- Open Code Composer Studio and create a new project (`File >
New > CCS Project`).
- Select the processor type as **TMS320C6748** and choose
Empty Project (main.c). Click on `Finish`.
3. Write the Code: Open the `main.c` file and write the code for the
DFT computation.
4. Debug and Build the Project:
- Click on the `Debug` option to compile the code.
- After successful debugging, build the project.
5. Run the Project: Run the project to execute the code.
6. View the Output:
- Go to `Tools > Graph > Single Time`.
- Set the DSP Data Type as `32-bit Floating Point`.
- Enter the start address (e.g., `a`) and click `OK`.
7. Graph Visualisation: The output graph will be displayed, showing
the frequency components of the signal.
By following the above steps, you will be able to compute the
Discrete Fourier Transform of various signals using the
TMS320C6748 DSP processor and visualize the results.
C program for the DFT of Various Signal
Given signal {1,2,1,2}, N=4
#include <stdio.h>
#include <math.h>
#define N 4 // Length of the signal
void calculateDFT(double signal[], double real[], double imag[])
{
for (int k = 0; k < N; k++) {
real[k] = 0;
imag[k] = 0;
for (int n = 0; n < N; n++) {
double angle = 2 * M_PI * k * n / N;
real[k] += signal[n] * cos(angle);
imag[k]-= signal[n] * sin(angle);
}
}
}
intmain () {
double signal[N] = {1, 2, 1, 2};
double real[N], imag[N];
calculateDFT(signal, real, imag);
printf("DFT of the given signal:\n");
for (int k = 0; k < N; k++) {
printf("X[%d] = %.2f + %.2fi\n", k, real[k], imag[k]);
}
return 0;
}
Result:{6,0,-2,0}
Given signal,X(t)=5+2cos(2*pi*t-90)+3cos(4*pi*t)
withFs=4Hz
#include <stdio.h>
#include <math.h>
#define N 4
void calculateDFT(double signal[], double real[], double imag[]) {
for (int k = 0; k < N; k++) {
real[k] = 0;
imag[k] = 0;
for (int n = 0; n < N; n++) {
double angle = 2 * M_PI * k * n / N;
real[k] += signal[n] * cos(angle);
imag[k]-= signal[n] * sin(angle);
}}}
intmain () {
double signal[N] ={8, 4,8,0};
double real[N], imag[N];
calculateDFT(signal, real, imag);
printf("DFT of the given signal:\n");
for (int k = 0; k < N; k++) {
printf("X[%d] = %.2f + %.2fi\n", k, real[k], imag[k]);}
return 0;
}
Result:{20,-4j,12,4j}
WAVEFORMS
Result:
Implementation of Discrete fourier transform (DFT) for various
signal on TMS3206748 Digital signal processor is successful. The
results match with the expected results