Andre, please try this example in C (CCS compiler): long int average_sensor; // filtered values (13 bits) long int vsensor; // sensor readings (13 bits) void read_sensor () { set_adc_channel(2); delay_us(10); vsensor = read_ADC(); } void filter() { static long int acumulator; acumulator = acumulator - (acumulator >> 3) + vsensor; average_sensor = acumulador >> 3; } main() { read_sensor(); filter(); } Best regards, Fabricio. ----- Original Message ----- From: "Andre Abelian" To: "Microcontroller discussion list - Public." Sent: Tuesday, June 19, 2007 5:52 PM Subject: RE: [pic:] Software low pass filter any idea? > Fabricio, > > thanks for your help. > since I use 2 bytes (13 bit) I will go with 13 or 16 bits. > > thanks > > Andre > > > > -----Original Message----- > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu]On Behalf > Of Marcos Fabricio Bezerra > Sent: Tuesday, June 19, 2007 12:12 PM > To: Microcontroller discussion list - Public. > Subject: Re: [pic:] Software low pass filter any idea? > > > Hi, Andre. > I advice you to use a digital implementation of an IIR filter. > How many bits do you really need? > Fabricio. > > > > ----- Original Message ----- > From: "Andre Abelian" > To: "Microcontroller discussion list - Public." > Sent: Tuesday, June 19, 2007 3:36 PM > Subject: [pic:] Software low pass filter any idea? > > >> Hi to all, >> >> I am using external 13 bit ADC witch originally won't necessary >> to go that high resolution "not under my control" now the result >> I am getting is noisy numbers are going high and low. what I did is >> reading it 10 times then I add them together then divide it by 10. >> It helps but one of our engineer asked me to add software low pass >> filter witch I am familiar with it. Reading 10 times values are up to 15 >> point >> different. >> My question is do you have any experience or know how software LPF work? >> any link or info will appreciate. I searched piclist.com not enough info >> I found to understand what to do. >> >> thank you for your help >> >> Andre >> >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist