📄 fixpoint_directiir.c
字号:
//
// Project: Experiment 5.7.2: implementation of fixed-point IIR filter in direct form I - Chapter 5
// File name: fixPoint_directIIR.c
//
// Description: This is the fixed-point IIR filter in direct form I realization
//
// 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
//
#include "fixPointIIR.h"
void fixPoint_IIR(short in, short *x, short *y,
short *b, short nb, short *a, short na)
{
long z1,z2,temp;
short i;
for(i=nb-1; i>0; i--) // Update the delay line x[]
{
x[i] = x[i-1];
}
x[0] = in; // Insert new data to delay line x[0]
for(z1=0, i=0; i<nb; i++) // Filter the x[] with coefficient b[]
{
temp = (long)x[i] * b[i];
temp += 0x400;
z1 += (short)(temp>>11);
}
for(i=na-1; i>0; i--) // Update the y delay line
{
y[i] = y[i-1];
}
for(z2=0, i=1; i<na; i++) // Filter the y[] with coefficient a[]
{
temp = (long)y[i] * a[i];
temp += 0x400;
z2 += (short)(temp>>11);
}
y[0] = (short)(z1 - z2); // Place the result into y[0]
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -