You have no items in your shopping cart.

Subtotal: 0.00

Periodogram using TMS320C6745 DSP

Aim

To perform the Periodogram of given discrete sequence in TMS320C6745 KIT..

Requirements

 

Theory

The periodogram is an estimate of the spectral density of a signal. It is convenient to have a word for some representation of a variable quantity which shall correspond to the 'spectrum' of a luminous radiation. I propose the word periodogram, and define it more particularly in the following way:

Let

where T may for convenience be chosen to be equal to

some integer multiple of

2π/k

and plot a curve with as abscissæ and

r=√a2 + b2

as ordinates; this curve, or, better, the space between this curve and the axis of abscissæ, represents the periodogram of f(t).

Procedure

1. Open Code Composer Studio v4 .

2. In WorkSpace Launcher.

  • BROWSE → Select the project location and make one new folder, MAKE NEW FOLDER → Type the Workspace name, OK → OK.

3. FILE ⇒ NEW ⇒ CCS PROJECT

  • Project name: Type your project name.
  • Tick use default location. → NEXT
  • Project type C6000.
  • Tick Debug And Release. → NEXT → NEXT.
  • Output type: Executable.
  • Device Variant : generic - TMS320C6745.
  • Device Endianness : little
  • Code Generation Tools: TI v6.1.12.
  • Run time support library: automatic.
  • Target content: none. →FINISH

4.FILE ⇒ NEW ⇒ SOURCE FILE

  • Source file: Type your projectname.c( .c extension is must ).
  • Type the program.
  • FILE → SAVE.

5. Paste the following board library files in workspace location.

  • Common folder (contains header files)
  • Gel folder (contains gel file)
  • Library folder(contains library files)

6. Paste the Linker file in the project location.(linker file is available in cd)

Note: Those folders and linker file are availble at cd.

7. PROJECT ⇒ PROPERTIES ⇒ C/C++ BUILD → BASIC OPTION

  • Target processor version(--silicon version, -mv) : 6400+ →OK.
  • IN C/C++ BUILD, INCLUDE OPTIONS (Add dir to #include search path(--include_path,-I)) select this add icon and add the following three path by indivdually - "${Diag}../../common/header" - "${XDAIS_CG_ROOT}/packages/ti/xdais" - "${C6000_CSL_CG_ROOT}/include"

8. FILE ⇒ NEW ⇒ TARGET CONFIGURATION FILE

  • file name: projectname. ccxml (.ccxml extension is must)
  • Connection: Texas Instrument XDS100 v1 USB Emulator.
  • Device: TMS320C6745. (Tick the TMS320C6745)→ SAVE → TARTGET CONFIGURATION → C674X_0 → BROWSE, browse the workspace location, open the gel folder and select the GEL file. → OPEN → SAVE.

9. In C/C++ Project window, Right click the project ⇒ REBUILD PROJECT.

10. Connections

  • Connect the usb cable, PC to TMS320C6745 KIT..
  • Connect the 5v adapter.
  • Power on the kit.

11. TARGET ⇒ DEBUG ACTIVE PROJECT.

12. TARGET ⇒ RUN.(Wait few Seconds)

13. TARGET ⇒ HALT.

14. TOOLS ⇒ GRAPH ⇒ SINGLE TIME .

  • Acquisition Buffer Size - 7
  • Dsp Data Type - 32 bit floating point
  • Start Address - period
  • Display Data Size – 7.
  • Ok, see the output at graph .

Program

#include 
#include 

#define	N	7 			//number of data values
#define 	xn 	4
#define 	hn 	4

float pi = 3.1416;
float rout[N],iout[N],out[2]={0,0},period[N]; 

short x[4] = {1,1,0,0},outval[8]; // Change Input for  different o/p.
unsigned int j=0;
long t1,t2,t3,t4,c;

void dft(short *x, short k, float *out);

void main()
{
	short j;
	int n,k,i,t[100]={0};
	
	for(i=0;i<(xn+hn-1);i++)
	{
		outval[i] = 0;
		t[i]=0;
		x[xn+i]=0;
	}
	
	for(i=0;i<N;i++)
	{
		rout[i] = 0;
		iout[i] = 0;
	}
	
	for(i=0,j=(hn-1);i<(hn);i++,j--)
		t[i] = x[j];

	for(n=0;n<(xn+hn-1);n++)
	{
		for(k=0;k<=n;k++)
			outval[n] = (outval[n])+((x[k])*(t[n-k]));
	}
	
	for (j = 0; j < N; j++)
	dft(outval, j, out); 		//call DFT function

	for(c=0;c<N;c++)
	{
		t1 = rout[c];
		t2 = iout[c];
		t1 = t1 * t1;
		t2 = t2 * t2;
		t3 = t1 + t2;
		t4 = sqrt(t3);
		period[c] = t4;
		}
	while(1);
}

void dft(short *x, short k, float *out) 		//DFT function
{
float sumRe = 0,sumIm = 0,cs = 0,sn = 0; 
int i = 0;
	
	for (i = 0; i < N; i++) 
	{ 
		cs = cos(2*pi*(k)*i/N);	//real component
		sn = sin(2*pi*(k)*i/N);		//imaginary component
		
		sumRe = sumRe + x[i]*cs; //sum of real components
		sumIm = sumIm - x[i]*sn; //sum of imaginary components
	}
	
	out[0] = sumRe; 
	out[1] = sumIm;
	rout[j] = out[0]; 
	iout[j] = out[1];
	j++;
//	printf("%f %f\n",out[0],out[1]);
}

Result

Thus, the Periodogram of given discrete sequence was performed and the result is stored and displayed at graph.