Practical Analog and Digital Filter Design

Appendix D: C Code for Normalized Approximation Functions

In the main file of the FILTER program on the CD, we called Calc_Filter_Coefs (as shown in Listing D.1) in order to calculate the necessary filter coefficients for the user-specified design. That function in turn called one of three other functions named Calc_Analog_Coefs, Calc_DigFIR_Coefs, or Calc_DigIIR_Coefs.

Listing D.1: Calc__Filter_Coefs function.
/*====================================================  Calc_Filter_Coefs() - determines implementation and  calls appropriate calculation function  Prototype:  int Calc_Filter_Coefs(Filt_Params *FP);  Return:     error value  Arguments:  FP - ptr to struct holding filter params ====================================================*/int Calc_Filter_Coefs(Filt_Params *FP){ int Error;                /*  error value */  /*  Call correct calc function for analog,      digital FIR or IIR filters. */  switch(FP->implem)  { case 'A':      Error = Calc_Analog_Coefs(FP);      if(Error) { return 10*Error+1;}      break;    case 'F':      Error = Calc_DigFIR_Coefs(FP);      if(Error) { return 10*Error+2;)      break;    case 'I':      Error = Calc_DigIIR_Coefs(FP);      if(Error) { return 10*Error+3;}      break;    default:      return ERR_FILTER;  }  return  ERR_NONE;}

The implementation type for the filter is stored in the FP->implem

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: IC Electronic Filters
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.