Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Electronic Equipment > Digital Signal Processing (DSP) > Re: Low pass fi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 7 Topic 14035 of 14332
Post > Topic >>

Re: Low pass filter on a PIC

by Jerry Avins <jya@[EMAIL PROTECTED] > Oct 10, 2008 at 11:29 PM

Tim Wescott wrote:

   ...

> If Jerry doesn't understand it, I didn't explain it well.

I just read it wrong. Sorry.

> Take gain = 0.1, input is constant 1, and output starts at 0.  Then you 
> should get:
> 
> step    output
> 0       0
> 1       0.1
> 2       0.19
> 3       0.271
> n       1 - 0.9^n
> 
>>>> A 20Hz cutoff is pretty high for a sampling rate of 50Hz -- you're
not
>>>> going to get much attenuation of your noise.
>>> The sampling rate is 100Hz. I might lower the cutoff further. But the
>>> previous implementation of this controller, done in the analog world,
>>> used 20 Hz with good results. But that was a third order filter.
> It's still high, even for a 100Hz sampling rate -- but not nearly as
bad.
> 
>> To measure entire periods, the sample rate should be 50 Hz. There is no
>> assurance that alternate half cycles have the same duration.
>>
> 
> Gin up a filter with a transfer function (z + 1)/(z - d), with d close
to 
> 1.  That'll let you update at 100Hz while rejecting the noise at 50Hz, 
> yet still giving you good response at somewhat lower frequencies.
> 
>>>> Keep in mind that as you lower the filter bandwidth you'll have to
>>>> back
>>>> off your pro****tional and integral gains to keep the loop stable.
>>> I know. That's also why I don't want to lower the cutoff frequency too
>>> much.
>>>
>>>> You may also find that you need to use more than 16 bits in the
filter
>>> to
>>>> maintain enough precision
>>> That would be a problem, because in the programming language I'm
using,
>>> I only have 16 bit integers, and no carry bit.
> 
> Then get another programming language!  If it's C, and it's remotely
ANSI 
> C compatible, then 'long' will be 32 bits.

Forth is great for embedded work and does double precision. (At a 100 Hz 
sample rate, I can do floating point in Forth on a 68HC11.)

   ...
> 
> You can extend precision in most any programming language if you can 
> stand the tedium -- but it's often easier to do things in assembly.

Few HLLs make the carry and overflow bits available. That makes extended 
precision a bit difficult (but the DEC Alpha doesn't have a carry bit).

Jerry
-- 
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
** Posted from http://www.teranews.com
**
 




 7 Posts in Topic:
Re: Low pass filter on a PIC
"Manfred" <m  2008-10-10 14:56:54 
Re: Low pass filter on a PIC
Jerry Avins <jya@[EMAI  2008-10-10 17:11:25 
Re: Low pass filter on a PIC
Tim Wescott <tim@[EMAI  2008-10-10 19:18:38 
Re: Low pass filter on a PIC
"Manfred" <m  2008-10-10 21:22:03 
Re: Low pass filter on a PIC
Jerry Avins <jya@[EMAI  2008-10-10 23:38:15 
Re: Low pass filter on a PIC
Jerry Avins <jya@[EMAI  2008-10-10 23:29:33 
Re: Low pass filter on a PIC
Tim Wescott <tim@[EMAI  2008-10-11 01:26:09 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 4:12:46 CST 2008.