You are currently viewing How to generate Sine Wave using TMS320C5505

How to generate Sine Wave using TMS320C5505

Spread the love

Aim

To Generate a sine waveform using TMS320C5505 DSP KIT

Requirements

☞CCS v4

TMS320C5505 KIT

☞USB Cable

☞5V Adapter

Theory

The simplest method to generate Sine wave is to use Trignometric Sin function. The Sin function will generate the samples from our specific parameter like sampling frequency, number of samples, input frequency. In this project, generating the correct sample is important. The library function “sin()” does all of the work.

Theory for How to generate Sine Wave using TMS320C5505

Its most basic form as a function of time (t) is:

where: A, the amplitude, is the peak deviation of the function from its center position. ω, the angular frequency, specifies how many oscillations occur in a unit time interval, in radians per second φ, the phase, specifies where in its cycle the oscillation begins at t = 0.

When the phase is non-zero, the entire waveform appears to be shifted in time by the amount φ/ω seconds. A negative value represents a delay, and a positive value represents an advance.

Procedure for generate Sine Wave using TMS320C5505

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: C5500.

☞Tick Debug And Release. → NEXT → NEXT.

☞Output type: Executable.

☞Device Variant : TMS320C55XX – TMS320C5505.

☞Device Endianness : big

☞Code Generation Tools: TI v4.3.5.

☞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.

☞include 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) : 5505 OK.

8. FILE ⇒ NEW ⇒ TARGET CONFIGURATION FILE

☞file name: projectname. ccxml (.ccxml extension is must)

☞Connection: Texas Instrument XDS100 v1 USB Emulator.

☞Device: TMS320C5505. (Tick the TMS320C5505)→ SAVE → TARTGET CONFIGURATION →C55XX_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 TMS320C5505 KIT

☞Connect the 5v adapter.

☞Power on the kit.

11. TARGET ⇒ DEBUG ACTIVE PROJECT.

12. TARGET ⇒ RUN.(wait to generate samples)

13. TARGET ⇒ HALT.

14. TOOLS ⇒ GRAPH >> SINGLE TIME

-Acquirstion buffer size : 256

-Index increment : 1

-Start address : value.

-Display data size : 256 → Ok.

Program

#include
#include
#define PI 3.14
short value[500];
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;
	int i,count,nsamp,value1;
	sampt = 1/sampf;
	nsamp = sampf/inpf;
	printf("\n Sampling Frequency is : %f",sampf);
	printf("\n Sampling Time is :%f",sampt);
	printf("\n Input Frequency is : %d",inpf);
	printf("\n The number of Sample is : %d",nsamp);
		for(count=0;count<nsamp;count++)
		{
			teta = (2 * PI * inpf * sampt * count);
			printf("\nteta = %lf",teta);
		
			value[count] = sin(teta)*1024;
			printf("\t sin %lf Value is : %d",teta,value[count]);
		}
	}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.