Waveform Generation
Using
TMS320C6745 DSP
https://www.pantechsolutions.net/products/dsp-
dsc-boards/tms320c6745-tyro
Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
List Of Waveforms
• Sine Wave
• Square Wave
• Triangular Wave
• Saw tooth Wave
Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
Program for Sine Wave Generation
#include<stdio.h>
#include<math.h>
#define PI 3.14
void main()
{
const float sampf = 1024000.0;// Sampling frquency is fixed
const int inpf = 4000; // change the input frquency from 1khz to 8khz(1000 to 8000)
float sampt;
double teta;
short value,*sinout;
int i,count,nsamp,value1;
sinout = (short *)0xc0000000;
sampt = 1/sampf;
nsamp = sampf/inpf;
for(i=0;i<400;i++)
*(sinout+i)=0;
for(count=0;count<nsamp;count++)
{
teta = (2 * PI * inpf * sampt * count);
value = sin(teta)*1024;
value1 = value&0x0000FFFF;
*sinout++ = value1;
}
}
Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
Plot Settings for Sine Wave
Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
Program for Square Wave Generation
#include <stdio.h>
#include <math.h>
void main()
{
int *Square;
int i;
Square = (int *)0xC0000000;
while(1)
{
for(i=0;i<50;i++)
{
*Square++ = 0x0000FFFF;
}
for(i=0;i<50;i++)
{
*Square++ = 0x0;
}
}
}
Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
Plot Settings for Square Wave
Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
Program for Triangular Wave Generation
#include <stdio.h>
#include <math.h>
void main()
{
int *Triangle;
int i=0,j=0;
Triangle = (int *)0xC0000000;
while(1)
{
for(i=0;i<50;i++)
{
j=j+1;
*Triangle++ = j;
}
for(i=50;i>0;i--)
{
j=j-1;
*Triangle++ = j;
}
}
}
Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
Plot Settings for Triangular Wave
Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
Program for Saw tooth Wave Generation
#include <stdio.h>
#include <math.h>
void main()
{
int *Sawtooth;
int i=0,j=0;
Sawtooth = (int *)0xC0000000;
while(1)
{
for(i=0;i<100;i++)
{
j=j+1;
*Sawtooth++ = j;
}
j=0;
i=0;
*Sawtooth++ = j;
}
}
Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
Plot Settings for Saw tooth Wave
Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
Thank You

Waveform Generation Using TMS320C6745 DSP

  • 1.
  • 2.
    Technology beyond theDreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. List Of Waveforms • Sine Wave • Square Wave • Triangular Wave • Saw tooth Wave
  • 3.
    Technology beyond theDreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Program for Sine Wave Generation #include<stdio.h> #include<math.h> #define PI 3.14 void main() { const float sampf = 1024000.0;// Sampling frquency is fixed const int inpf = 4000; // change the input frquency from 1khz to 8khz(1000 to 8000) float sampt; double teta; short value,*sinout; int i,count,nsamp,value1; sinout = (short *)0xc0000000; sampt = 1/sampf; nsamp = sampf/inpf; for(i=0;i<400;i++) *(sinout+i)=0; for(count=0;count<nsamp;count++) { teta = (2 * PI * inpf * sampt * count); value = sin(teta)*1024; value1 = value&0x0000FFFF; *sinout++ = value1; } }
  • 4.
    Technology beyond theDreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Plot Settings for Sine Wave
  • 5.
    Technology beyond theDreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Program for Square Wave Generation #include <stdio.h> #include <math.h> void main() { int *Square; int i; Square = (int *)0xC0000000; while(1) { for(i=0;i<50;i++) { *Square++ = 0x0000FFFF; } for(i=0;i<50;i++) { *Square++ = 0x0; } } }
  • 6.
    Technology beyond theDreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Plot Settings for Square Wave
  • 7.
    Technology beyond theDreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Program for Triangular Wave Generation #include <stdio.h> #include <math.h> void main() { int *Triangle; int i=0,j=0; Triangle = (int *)0xC0000000; while(1) { for(i=0;i<50;i++) { j=j+1; *Triangle++ = j; } for(i=50;i>0;i--) { j=j-1; *Triangle++ = j; } } }
  • 8.
    Technology beyond theDreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Plot Settings for Triangular Wave
  • 9.
    Technology beyond theDreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Program for Saw tooth Wave Generation #include <stdio.h> #include <math.h> void main() { int *Sawtooth; int i=0,j=0; Sawtooth = (int *)0xC0000000; while(1) { for(i=0;i<100;i++) { j=j+1; *Sawtooth++ = j; } j=0; i=0; *Sawtooth++ = j; } }
  • 10.
    Technology beyond theDreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Plot Settings for Saw tooth Wave
  • 11.
    Technology beyond theDreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Thank You