On Oct 10, 4:19 pm, "Manfred" <mmorn...@[EMAIL PROTECTED]
> wrote:
> Hi all!
>
> Maybe someone here might help me with a DSP problem that should be
> trivial, but to me, as a newbie to DSP, is not.
>
> I'm developing a microcontroller-based speed controller for my small
> hydroelectric plant. I'm using a PIC 16F628 for this. I'm detecting the
> zero crossings of the 50Hz signal coming from the generator, and
measuring
> the duration of each half cycle, obtaining a signal at a rate of 100
> samples per second. The signal is in 16 bit format, and nominally 10000
> counts tall. Typical variations are a few tens of counts, and
occasionally
> as much as 1000 counts. I'm subtracting the 10000 reference, and using
the
> resulting error signal as input to a pro****tional-integral control
> function, whose output drives dump loads that burn off the excess output
> from the generator.
>
> The little problem I have is that a small 420Hz signal on the power
line,
> apparently coming from the generator's internal voltage regulator, is
> causing jitter in the zero crossings, which is in turn causing the
> pro****tional function of my controller to imprint an unwanted modulation
on
> its output. So I would like to apply a low pass filter function to my
> signal, with a cutoff frequency of roughly 20Hz, before the P-I
function.
>
> The question is: How can I implement this DSP low pass filter? It has to
> be in some simple way, because neither the PIC nor I can handle overly
> complex math!
>
> The only thing I can come up with is averaging the last several samples,
> perhaps with some weighing. But there must be some better method!
>
> It is desirable that the time delay in the filter be as short as
> possible.
>
> I would be most grateful for any help in this, be it with an explanation
> of how to implement the filter, or a hint as to where I can find this.
>
> Manfred Mornhinweghttp://ludens.cl
Yes - it's called a resistor and a capacitor. Put the capacitor to
ground and the resistor in series. Voila and no programming - now
that's such a great discovery that two components can do better than a
pic.
Hardy


|