Czy zna ktoś program, który służy do projektowania filtrów cyfrowych, a który potrafi przy okazji wygenerować odpowiedni kod np. w C. Program "Filter Solutions" ma taką opcje, ale niestety tylko w pełnej wersji, której nigdzie nie mogę znaleźć.
Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamfloat DigFil(float invar, float initval, int setic)
//float invar, initval; int setic;
/******************************************************************************/
/* Filter Solutions Version 10.0 Nuhertz Technologies, L.L.C. */
/* www.nuhertz.com */
/* +1 602-206-7781 */
/* 4th Order Low Pass Chebyshev I */
/* Bilinear Transformation with Prewarping */
/* Sample Frequency = 32.50 KHz */
/* Standard Form */
/* Arithmetic Precision = 4 Digits */
/* */
/* Pass Band Frequency = 500.0 Hz */
/* Pass Band Attenuation = 20.00 dB */
/* Pass Band Ripple = 1.000 dB */
/* */
/* Stop Band Ratio = 0.7426 */
/* Stop Band Frequency = 371.3 Hz */
/* Stop Band Attenuation = 24.31 dB */
/* */
/******************************************************************************/
/* */
/* Input Variable Definitions: */
/* Inputs: */
/* invar float The input to the filter */
/* initvar float The initial value of the filter */
/* setic int 1 to initialize the filter to the value of initvar */
/* */
/* There is no requirement to ever initialize the filter. */
/* The default initialization is zero when the filter is first called */
/* */
/******************************************************************************/
/* */
/* This software is automatically generated by Filter Solutions. There are */
/* no restrictions from Nuhertz Technologies, L.L.C. regarding the use and */
/* distributions of this software. */
/* */
/******************************************************************************/
{
float sumnum, sumden; int i;
static float delay[5] = {0.0,0.0,0.0,0.0,0.0};
static float znum[5] = {
3.035e-07,
1.214e-06,
1.821e-06,
1.214e-06,
3.035e-07
};
static float zden[4] = {
.9397,
-3.813,
5.807,
-3.934
};
if (setic==1)
{
for (i=0;i<=4;i++)
delay[i] = 2.06e+05*initval;
return initval;
}
else
{
sumden=0.0;
sumnum=0.0;
for (i=0;i<=3;i++)
{
delay[i] = delay[i+1];
sumden += delay[i]*zden[i];
sumnum += delay[i]*znum[i];
}
delay[4] = invar-sumden;
sumnum += delay[4]*znum[4];
return sumnum;
}
}
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{
TIMSK=0x00; // stop timer
OCR0=ceil(DigFil(read_adc(0), 0, 0)); // send to DAC
TIMSK=0x01; // start timer
}