From: gpezzella on 1 Jul 2010 03:21 Dear Jerry >I'm afraid that I'm not much help. It should be clear to you that you >don't even know enough to ask the right questions. You have to >understand the system before digging into the details Yes it is true. I don't have enough knowledge but I would try to do it. For this I ask you to have great patience with me :-) I'm absolute newbye in DSP. >You can sample as low as 500 Hz to save processing time. 2.48KHz Sampling Rate is obtained with the most High Prescaler. If I would go more slow I should lower Main Clock but this slow all processing time >Then you might be able to use a single or two-section exponential averager Now I have lost you....Have you code sample with comment that explane how to implement it? Remember that you are talking with a "child dsp developer" Giuseppe
From: Jerry Avins on 1 Jul 2010 08:14 On 7/1/2010 3:21 AM, gpezzella wrote: > Dear Jerry > >> I'm afraid that I'm not much help. It should be clear to you that you >> don't even know enough to ask the right questions. You have to >> understand the system before digging into the details > Yes it is true. I don't have enough knowledge but I would try to do it. > For this I ask you to have great patience with me :-) > I'm absolute newbye in DSP. > >> You can sample as low as 500 Hz to save processing time. > 2.48KHz Sampling Rate is obtained with the most High Prescaler. > If I would go more slow I should lower Main Clock but this slow all > processing time > >> Then you might be able to use a single or two-section exponential > averager > Now I have lost you....Have you code sample with comment that explane how > to implement it? > Remember that you are talking with a "child dsp developer" Are you sure that the sample rate is so intimately tied to the processor clock? If so, you can simply use every 5th sample and discard the rest. It might be that processing all the samples uses fewer clock cycles than deciding which ones to keep. If so, no harm done. An exponential averager is also called a leaky accumulator. Some notation: x[i] is input sample #i. x[i+1] is the sample after that, and so on. y[1] is output # i, and y[i-1] the output that preceded it. An exponential averager slowly forgets the past, like a capacitor and resistor in parallel whose inputs are current pulses. y[1] = k*x[i] (1-k)*y[i-1] behaves like a single RC. The value of k sets the "time constant". There are more efficient ways than simply cascading two or more of these to sharpen the cut-off, but that works. Smith's book provides details, as does the Bores site I recommended. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
From: Tim Wescott on 1 Jul 2010 10:25 On 07/01/2010 12:21 AM, gpezzella wrote: > Dear Jerry > >> I'm afraid that I'm not much help. It should be clear to you that you >> don't even know enough to ask the right questions. You have to >> understand the system before digging into the details > Yes it is true. I don't have enough knowledge but I would try to do it. > For this I ask you to have great patience with me :-) > I'm absolute newbye in DSP. > >> You can sample as low as 500 Hz to save processing time. > 2.48KHz Sampling Rate is obtained with the most High Prescaler. > If I would go more slow I should lower Main Clock but this slow all > processing time > >> Then you might be able to use a single or two-section exponential > averager > Now I have lost you....Have you code sample with comment that explane how > to implement it? > Remember that you are talking with a "child dsp developer" There's a lot of material to cover to get up to speed for even simple DSP problems -- which leaves the education you can get from USENET posts pretty spotty. Get a copy of "Understanding Digital Signal Processing" by Rick Lyons, and start working through it. Or see if Wikibooks has anything equivalent. You'll be rewarded for your effort. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
From: gpezzella on 8 Jul 2010 05:14 Dear Jerry just yesterday I have discovery another thread (http://www.dsprelated.com/showmessage/13897/1.php) in this forum that talk about the equation that you wrote to me: -------------------------------- Y(i) = K * X(i) + (1-K) * Y(i-1) -------------------------------- The difference is only apparent: ----------------------------------- Y(i) = [X(i) - Y(i-1)] * K + Y(i-1) ----------------------------------- Now in that thread the author say this: Where the desired time constant is known, use the following method. Assuming an input step from 0.0 to +1.0, an RC LPF will change its output voltage towards the new input by an amount equal to: ts -(--) Where: ts = sample period (seconds) T T = time constant (seconds) (1) K = 1 - e K = change in o/p after 1 ts The value for K is then used as the coefficient in the RC LPF code. If the above equation is correct I should use for my case: 1)Ft = 50 Hz 2)Sample Rate = 2.48KHz 1 T = ------- = 0.00318 2*Pi*50 ts = 1/2.48 Hz = 0.0004 0.0004 -(--------) 0.00318 K = 1 - e = 1 - 0.88 = 0.12 Is this my equation? ---------------------------------------- Y(i) = [X(i) - Y(i-1)] * 0.12 + Y(i-1) ---------------------------------------- Thanks
From: gpezzella on 8 Jul 2010 05:17
Dear Jerry just yesterday I have discovery another thread (http://www.dsprelated.com/showmessage/13897/1.php) in this forum that talk about the equation that you wrote to me: -------------------------------- Y(i) = K * X(i) + (1-K) * Y(i-1) -------------------------------- The difference is only apparent: ----------------------------------- Y(i) = [X(i) - Y(i-1)] * K + Y(i-1) ----------------------------------- Now in that thread the author say this: Where the desired time constant is known, use the following method. Assuming an input step from 0.0 to +1.0, an RC LPF will change its output voltage towards the new input by an amount equal to: ts -(--) Where: ts = sample period (seconds) T T = time constant (seconds) (1) K = 1 - e K = change in o/p after 1 ts The value for K is then used as the coefficient in the RC LPF code. If the above equation is correct I should use for my case: 1)Ft = 50 Hz 2)Sample Rate = 2.48KHz 1 T = ------- = 0.00318 2*Pi*50 ts = 1/2.48 Hz = 0.0004 0.0004 -(--------) 0.00318 K = 1 - e = 1 - 0.88 = 0.12 Is this my equation? ---------------------------------------- Y(i) = [X(i) - Y(i-1)] * 0.12 + Y(i-1) ---------------------------------------- Thanks |