📄 sine.c
字号:
/*
* Copyright (c) 2001-2002, Texas Instruments Incorporated.
* All rights reserved. Property of Texas Instruments Incorporated.
* Restricted rights to use, duplicate or disclose this code are
* granted through contract.
*/
/*
* Description: This application uses Probe Points to obtain input
* (a sine wave). It then takes this signal, and applies a gain
* factor to it.
*/
#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
#if defined(_TMS320C2XX)
#define WDCR *((volatile int *)0x7029) /* WD Control reg */
#define DISABLE_WD 0x0068
/*******************************************************
Disable_WD()
============
This function disables the f24xx watch dog timer;
*******************************************************/
void Disable_WD(void)
{
WDCR |= DISABLE_WD;
}
#endif
// main start
void main()
{
#if defined(_TMS320C2XX)
Disable_WD();
#endif
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;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -