1 / 4

FIR and IIR Filters with on and off Functionality

FIR and IIR Filters with on and off Functionality. By: Nitin Jalan For: Dr. V. Kepuska Subject: Microcomputer System 1. IIR Filter: High And Low Pass. //Low pass filter IIR function void lowpassfilter_IIR(void) {

lumina
Download Presentation

FIR and IIR Filters with on and off Functionality

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FIR and IIR Filters with on and off Functionality By: Nitin Jalan For: Dr. V. Kepuska Subject: Microcomputer System 1

  2. IIR Filter: High And Low Pass • //Low pass filter IIR function • void lowpassfilter_IIR(void) • { • float x = (float)(iChannel0LeftIn<<8); //shifts bits of the float x 8 bits to the left • int s; • for(s = 0; s <= 2; s++) //increments s from 0 to 2 • { • lpd0[s] = x - (lpA1[s]*lpd1[s]) - (lpA2[s]*lpd2[s]); //delay equation • x = (lpB2[s] * lpd2[s]) + (lpB1[s] * lpd1[s]) + (lpB0[s] * lpd0[s]); //output equation • lpd2[s] = lpd1[s]; //shifts the delays each sampling • lpd1[s] = lpd0[s]; • } • iChannel0LeftOut = ((int)x) >> 8; //shifts the output back 8 bits to the right • }

  3. FIR FIltters: High Pass and Low PAss • void highpassfilter_FIR(void) • { • x[n] = (fract16) (iChannel0RightIn>>8); //shifts the x[n] 8 bits to the right • if (variables<1024) • { • buffer[variables++]= x[n]; //Buffer • } • output = 0; //sets the output to 0 • for(p=0; p<101; p++) • { • output = add_fr1x16(output, mult_fr1x16(x[(n-p+101) %101],yhp[p])); //filter delay equation including circular buffer • //uses fract16 funcions • } • n++; //increment pointer • n = n % 101; //keeps the pointer positive • iChannel0RightOut=((int)(output))<<8; //Output is shifted back 8 bits to the left • }

  4. References • my.fit.edu/~vkepuska/ece3551 • Christian Stumf and Ryan Boleman Lab

More Related