To Generate Different Signals Using DSP controller


SOFTWARE USED: Code Composer Studio

HARDWARE REQUIRED: DSP controller board (TMS320F28335), JTAG, XDS100V2 board

THEORY:

A signal is a way of conveying information. Gestures, semaphores, images, sound, all can be signals. We will distinguish 3 forms of signals:

  • Continuous-Time/Analog Signal
  • Discrete-Time Signal
  • Digital Signal

In this Experiment, we will form the continuous signals only. A finite, real-valued, smooth function s(t) of a variable t which usually represents time. Both s and t in s(t) are continuous. In continuous we can do all types like triangular, sawtooth, trapezoidal.


Code for Triangle Wave :

#include <stdio.h>

#include <math.h>

 

float s[200];

float t;

int n=0;

 

void main()

{

    for(t=0;t<=10; t=t+0.1)

    {

        s[n]=0.1*t;

        n++;

    }

    for(t=10;t<20; t=t+0.1)

       {

           s[n]=-0.1*(t)+2;

           n++;

       }

}


Sawtooth Wave:

#include <stdio.h>

#include <math.h>

float s[10];

float t;

int n=0;

 

void main()

{

for(t=0;t<=10;t=t+0.1)

{

    if(t==10)

            s[n]=0;

    else

        s[n]=10*t;

    n++;

}

 

}

Code for Trapezoidal Wave:

#include <stdio.h>

#include <math.h>

 

float s[400];

float t;

int n=0;

 

void main()

{

    for(t=0;t<=5; t=t+0.1)

    {

        s[n]=0.2*t;

        n++;

    }

    for(t=5;t<=15;t=t+0.1)

    {

        s[n]=1;

        n++;

    }

    for(t=15;t<=20; t=t+0.1)

       {

           s[n]=-0.2*(t)+4;

           n++;

       }

    for(t=20;t<=25; t=t+0.1)

           {

               s[n]=-0.2*(t)+4;

               n++;

           }

    for(t=25;t<=35;t=t+0.1)

        {

            s[n]=-1;

            n++;

        }

    for(t=35;t<=40; t=t+0.1)

        {

            s[n]=0.2*t-8;

            n++;

        }

 

}


Post a Comment

Please do not enter any spam links in the comments...

Previous Post Next Post