网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 61IC中国电子在线 >> DSP >> 代码示例 >> TI DSP代码示例 >> C6000 >> 文章正文
  sinewave         ★★★ 【字体:
sinewave
作者:A007    文章来源:本站    点击数:    更新时间:2007-3-15    

 

装入并运行应用程序
1. 启动CCS后,打开位于C:\ti\tutorial\evm6201\sinewave下的工程文件sinewave.pjt,观察CCS的工程视图窗口,发现Projects项下的sinewave.pjt已经被加入其中。打开Source子项,可见本工程只有一个源文件sine.c。用鼠标双击,会打开一个源文件窗口,并将sine.c装入其中。
2. 选择菜单命令“Project”|“Build”,或者单击工具栏上的Incremental Build按钮,完成编译链接,得到.out文件。注意输出窗口中应该显示没有错误和警告。
3. 选择“File”|“Load Program”命令,加载程序,然后在“Load Program”对话框中选择打开C:\ti\tutorial\evm6201\sinewave\debug目录中的sinewave.out文件。程序加载后会自动打开一个反汇编窗口,此时黄色小箭头指向的是c_init00,这是C语言引导代码的入口。
4. 选择“Debug”|“Go Main”命令,此时会自动打开main.c源文件窗口,并停在main()函数入口处。从这里开始就可以调试用户程序了。
sine.h代码
// ****************************************************************
// Description: This application uses ProbePoints to obtain input
// (a sine wave). It then takes this signal, and applies a gain
// factor to it.
// Filename: Sine.h
// ****************************************************************

// define boolean TRUE
#ifndef TRUE
#define TRUE 1
#endif

// buffer constants
#define BUFFSIZE 0x64
#define INITIALGAIN 5

// IO buffer structure
typedef struct IOBuffer {
int input[BUFFSIZE];
int output[BUFFSIZE];
} BufferContents;

sine.c代码

// ****************************************************************
// Description: This application uses Probe Points to obtain input
// (a sine wave). It then takes this signal, and applies a gain
// factor to it.
// Filename: Sine.c
// ****************************************************************

#include <stdio.h>
#include "sine.h"

// gain control variable
int gain = INITIALGAIN;

// declare and initalize a IO buffer
BufferContents currentBuffer;

// Define some functions
static void processing(); // process the input and generate output
static void dataIO(); // dummy function to be used with ProbePoint

void main()
{
puts("SineWave example started.\n");

while(TRUE) // loop forever
{
/* Read input data using a probe-point connected to a host file.
Write output data to a graph connected through a probe-point. */
dataIO();

/* Apply the gain to the input to obtain the output */
processing();
}
}

/*
* FUNCTION: Apply signal processing transform to input signal
* to generate output signal
* PARAMETERS: BufferContents struct containing input/output arrays of size BUFFSIZE
* RETURN VALUE: none.
*/
static void processing()
{
int size = BUFFSIZE;

while(size--){
currentBuffer.output[size] = currentBuffer.input[size] * gain; // apply gain to input
}
}

/*
* FUNCTION: Read input signal and write processed output signal
* using ProbePoints
* PARAMETERS: none.
* RETURN VALUE: none.
*/
static void dataIO()
{
/* do data I/O */
return;
}

               欢迎点击进入:TI德州中文网   (国内唯一针对TI应用的中文技术网站)    文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    没有相关文章
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    站长:61IC 湘ICP备05002478号