/* Program: kqm_to_n.c Revision: 21-JULY-2006 ---------- Differential Amplifier Low Pass Filter Calculation Program step #1 This program ask for you to enter three parameters: The pass-band gain of the filter "K" which is equal to R2/R1 The "Q" of the filter, which is: 0.707 for Butterworth, 0.577 for Bessel The value "m" where R2 = R and R3 = mR The program then outputs the value "n" where C1 = C and C2 = nC This program is setup to provide the values for differential Low Pass filters and it assumes that the gain "K" is always positive. The equation is: [ Q (1 + m(K+1))] **2 n = ----------------------- 2m Refer to TI sloa_054 documentation about fully differential amplifiers. */ #include #include #define PI 3.1415926 main () { float K ; /* the pass-band gain of the filter */ float Q ; /* the required Q of the filter pole pair */ float m ; /* the value where R2 = R and R3 = mR */ float n ; /* the value where C1 = C and C2 = nC */ float temp_1, temp_2, temp_3, temp_4, temp_5 ; printf(" \n "); printf("Enter the required pass-band gain of the filter K, \n"); printf(" the required quality of the filter Q, and \n"); printf(" m where m is defined as R2 = R and R3 = mR \n"); printf(" \n "); printf(" Enter the filter gain \"K\" : "); scanf( "%f", &K ) ; printf(" \n ") ; printf(" Enter the filter quality \"Q\" : "); scanf( "%f", &Q ) ; printf(" \n ") ; printf(" Enter \"m\" where R2 = R and R3 = mR : "); scanf( "%f", &m ) ; printf(" \n ") ; printf( "\n The filter gain \"K\" is = %7.3f \n", K ) ; printf( "\n The filter \"Q\" is = %7.3f \n", Q ) ; printf( "\n The resistor ratio \"m\" (where R3 = mR) is = %7.3f \n", m ) ; temp_1 = Q * (1.0 + ( m * ( K + 1.0 ) ) ) ; temp_2 = temp_1 * temp_1 ; n = temp_2 / ( 2 * m ) ; printf( "\n The capacitor ratio \"n\" (where C2 = nC) is = %7.4f \n", n ) ; }