You are currently viewing Sampling of input signal & display using TMS320C6745 DSP

Sampling of input signal & display using TMS320C6745 DSP

Spread the love

Aim

To Sample the input sinewave waveform using TMS320C6745 DSP KIT.

Requirements

☞CCS v4

TMS320C6745 KIT

☞USB Cable

☞5V Adapter

Theory

Sampling is the process of converting a signal (for example, a function of continuous time or space) into a numeric sequence (a function of discrete time or space) at the regular time interval. The sampling frequency should be greater than or equal to 2*input frequency, and the frequency should be bounded.

i,e.,

fs = 2 * finput

where fs= sampling frequency. To avoid alias, always our input frequency is lesser than the half the sampling frequency. The input Sinusoidal signal is sampled through ADC (MCP3202) at regular interval. Then the generated sample is stored to to display in CCS Graph Tool.

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 iconadd iconand 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 KIT)→ 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.

Note: Connect the Function generator probe positive terminal to Adc input pin and negative terminal to ground. Set the frequency as 1Khz & Amplitude as 3V.

12. TARGET ⇒ RUN. (wait few seconds read samples)

13. TARGET ⇒ HALT.

14. TOOLS ⇒ GRAPH ⇒ SINGLE TIME

☞Acquirstion buffer size : 500

☞Index increment : 1

☞Start address : adc_value.

☞Display data size : 500 → Ok.

Program

#include "stdio.h"

#include "c6745.h"

#include "spiadc.h"

signed int adc_value[1000];

 

void main( void )

{      

        static Uint8 spiadcbuf[3];

        unsigned int j;

        short *out,i=0;

        C6745_init( );

       

        out = (short *)0xc0000000;

    spiadc_init();

   

        for(i=0;i<500;i++)

        {

                spiadcbuf[0] = 0x01; // setup command

        spiadcbuf[1] = 0xBF;

        spiadcbuf[2] = 0x00;

               

                        spiadc_cycle(spiadcbuf, 3);  // Execute spiadc read cycle

                        adc_value[i] = ((spiadcbuf[1]&0x0f) << 8)| spiadcbuf[2];

                        //for(j=0;j<100000;j++);

        }

        printf("ALL PROCESSED");

        while(1);

}

Result

Thus, the Sampling of input sine waveform was sampled and Displayed the sampled signal in Graph.

Leave a Reply

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