Function Descriptions
Example:
The following sample code obtains the FIR response to a sample input.
#include FPU.h
#define FIR_ORDER 31
#define SIGNAL_LENGTH (FIR_ORDER + 1)
*
2
*
2
#pragma DATA_SECTION(firFP, "firfilt")
FIR_FP firFP = FIR_FP_DEFAULTS;
#pragma DATA_SECTION(dbuffer, "firldb")
float dbuffer[FIR_ORDER+1];
#pragma DATA_SECTION(sigIn, "sigIn");
#pragma DATA_SECTION(sigOut, "sigOut");
float sigIn[SIGNAL_LENGTH];
float sigOut[SIGNAL_LENGTH];
#pragma DATA_SECTION(coeff, "coefffilt");
float const coeff[FIR_ORDER+1]= FIR_FP_LPF32;
float RadStep = 0.062831853071f;
float RadStep2 = 2.073451151f;
float Rad = 0.0f;
float Rad2 = 0.0f;
float xn,yn;
int count = 0;
void main()
{
unsigned int i;
/
*
FIR Generic Filter Initialisation
*
/
firFP.order=FIR_ORDER;
firFP.dbuffer_ptr=dbuffer;
firFP.coeff_ptr=(float
*
)coeff;
firFP.init(&firFP);
for(i=0; i < SIGNAL_LENGTH; i++)
{
xn=0.5
*
sin(Rad) + 0.5
*
sin(Rad2); //Q15
sigIn[i]=xn;
firFP.input= xn;
firFP.calc(&firFP);
yn = firFP.output;
sigOut[i]=yn;
Rad = Rad + RadStep;
Rad2 = Rad2 + RadStep2; }
}
Sep 10, 2012 48