⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c55cosinetest.c

📁 CHP 3 - Real-Time Digital Signal Processing: Implementations and Applications, Second Edition by Sen
💻 C
字号:
// 
//  Project: Experiment 3.6.5.3 Function Approximaiton - Chapter 3 
//  File name: c55CosineTest.c   
//
//  Description: This experiment program is implemented for testing the assembly
//               routine implementation of cosine function in the range of [0, PI/2]
//               using function: cos(x)=1-(1/2!)x^2+(1/4!)x^4-(1/6!)x^6
//
//  For the book "Real Time Digital Signal Processing: 
//                Implementation and Application, 2nd Ed"
//                By Sen M. Kuo, Bob H. Lee, and Wenshun Tian
//                Publisher: John Wiley and Sons, Ltd
//
//  Tools used: CCS v.2.12.07
//              TMS320VC5510 DSK Rev-C
//

#define PI (double)3.1415926
#define UNITQ15  0x7FFF
#define UNITQ14  0x3FFF

extern short cosine(short T0);

void main(void)
{
  static double y[5];
  short  x[5],z[5];
	
  x[0] = (short)(0);                     // Q14 format input in rad
  x[1] = (short)(UNITQ14*PI/6.0);        // Q14 format input in rad
  x[2] = (short)(UNITQ14*PI/4.0);        // Q14 format input in rad
  x[3] = (short)(UNITQ14*PI/3.0);        // Q14 format input in rad
  x[4] = (short)(UNITQ14*PI/2.0);        // Q14 format input in rad
	
  z[0] = cosine(x[0]);                   // Assembly funciton calculation
  z[1] = cosine(x[1]);                   // Assembly funciton calculation
  z[2] = cosine(x[2]);                   // Assembly funciton calculation
  z[3] = cosine(x[3]);                   // Assembly funciton calculation
  z[4] = cosine(x[4]);                   // Assembly funciton calculation

  y[0] = (double)z[0]/UNITQ15;
  y[1] = (double)z[1]/UNITQ15;
  y[2] = (double)z[2]/UNITQ15;
  y[3] = (double)z[3]/UNITQ15;
  y[4] = (double)z[4]/UNITQ15;                       
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -