Question
Embedded System Programming What implements the following code and which kind of buffer is xbuff ? (Explain the main functionalities of the code, no need
Embedded System Programming
What implements the following code and which kind of buffer is xbuff ?
(Explain the main functionalities of the code, no need to explain every line.)
#define BUFFSIZE 11
double FIR( double x)
{
static double b[BUFFSIZE] ={ -0.0048, 0.0032, 0.0413, -0.0133, -0.2896 \
0.5195, -0.2896, -0.0133, 0.0413, 0.0032, -0.0048};
static double xbuff[BUFFSIZE] ;
static double* bottom_p= xbuff;
static double* fill_p= xbuff;
static double* read_p= xbuff ;
static double* top_p= bottom_p +( BUFFSIZE -1);
int i;
double y = 0;
*fill_p=x;
read_p=fill_p;
if (++fill_p> top_p){
fill_p= bottom_p;
}
for (i=0; i< BUFFSIZE; i++){
y = y + b[i] * (*read_p);
if ((++read_p) > top_p)
read_p=bottom_p;
}
return y;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started