PIC10F220 RC filter first order

(instructions, reset, WDT, specifications...) PIC10F2xx, PIC12F5xx, PIC16F5x

PIC10F220 RC filter first order

Postby thierryneuch » Sun Jun 07, 2015 1:20 pm

I want to make an electronic device that Measures the wind speed in Beaufort. The definition of the Beaufort scale requires the calculation of an average over a period of 10 minutes. We choose to do this using the following principle (average with forgetfulness): filtre-passe-bas2.gif

For economical and space reasons, we choose to realize the RC filter by numerical simulation in the microcontroller.
Power supply: 3V analog output voltage proportional to the Beaufort scale with 0 corresponding to 0V Beaufort, 3V corresponding to 9 Beaufort (it will not show values above 9 Beaufort)
Interface to the LCD module: SPI (SPIdatas and SPI clk) Wind speed encoded in 8 bits

I expected to find some help here because I have almost no idea how to program in assembly language.
I have difficulties and problems understanding the management and integration of SPI communication and problems And difficulty as the exact conversion speed => Beaufort and how to use it, and to make a sliding average

The code is highly optimized That's why I come to ask your help :fs: and knowledge. Any ideas is welcome!

Posts: 1
Joined: Sun Jun 07, 2015 1:06 pm
PIC experience: EE Student

Re: PIC10F220 RC filter first order

Postby Ian.M » Mon Jun 08, 2015 12:44 am

A PIC10F220 only has 256 instructions of program memory and 16 bytes RAM, By the time you've implemented ADC acquisition and bitbanged SPI output I doubt you will have enough resources left to implement any useful filtering algorithm for any sample rate higher than once per minute, and I wouldn't be surprised to find you run out of space even trying to do that.

You should probably be looking at the dsPIC family.
Verified identity
Posts: 95
Joined: Wed May 28, 2014 12:47 am
PIC experience: Professional 1+ years with MCHP products

Re: PIC10F220 RC filter first order

Postby tunelabguy » Wed Jun 10, 2015 3:30 pm

I agree with Ian that the PIC10F220 is not up to the job. But I don't think you need to go to a dsPIC. The speed of your averaging calculations can be carried out on the simplest of PICS (but with more program space than the 10F220). Also I'm not sure what "averaging with forgetfulness" is, but I suspect it is not the equivalent of an RC first order filter, which has "memory" into the arbitrary past. It sounds to me a lot more like a boxcar average. Each 10-minute interval starts out with no memory (forgetfulness?) of what went before. You simply add up all the measurements you get during those 10 minutes and at the end, you divide by the number of measurements. This will probably take a serious multi-byte accumulator - maybe 32 bit - so as not to overflow while adding up all the readings for 10 minutes. And the division at the end might be hard to do in assembly, but if you are clever in how you time your readings, you can make the number of readings over a 10-minute period come out to be a power of 2, so dividing by the number readings is just shifting your accumulator to the right a certain number of bits.
User avatar
Verified identity
Posts: 29
Joined: Sun Jul 20, 2014 9:41 pm
PIC experience: Professional 5+ years with MCHP products

Return to 12-Bit Core

Who is online

Users browsing this forum: No registered users and 3 guests