/* Program: TRIM.c Revision: 13-JUNE-1997 This program ask for you to enter three parameters: Value of the Trim Pot in Ohms when it is set at its maximum resistance. Value of the network with the Trim Pot is set at its maximum resistance. Value of the network with the Trim Pot is set at its minimum resistance. +------+ | | POT R1 | V +-----WWW-------------WWW-------+ | | 0---------+ +----------0 | | +-------------WWW---------------+ R2 Note that there is not a solution for this circuit when the required span of the network is greater than the value of the pot. Note that a circuit of this type is useful when the value of the pot is large compared to the required span of the network. In this case, this network can give a more linear adjustment than the other option, i.e. +------+ | | POT | V +-----WWW------+ R1 | | 0---------+ +--------WWW------------0 | | +-----WWW------+ R2 */ #include #include #define PI 3.1415926 main () { float pot ; /* the value of the trim pot in Ohms */ float max ; /* the maximum value of the network, pot at full */ float min ; /* the minimum value of the network, pot at 0 */ float temp_1, temp_2, temp_3, temp_4, temp_5 ; float res_1, res_2 ; printf(" \n "); printf("Enter the trim pot value in Ohms, the networks maximum \n "); printf("resistance in Ohms and the networks minimum resistance \n"); printf("in Ohms. \n"); printf(" \n "); printf("Enter Trim Pot resistance (Ohms) : "); scanf( "%f", &pot ) ; printf(" \n ") ; printf(" Enter the maximum network resistance (Ohms): "); scanf( "%f", &max ) ; printf(" \n ") ; printf(" Enter the minimum network resistance (Ohms): "); scanf( "%f", &min ) ; printf(" \n ") ; printf( "\n The Trim Pot is = %7.2f Ohms \n", pot ) ; printf( "\n The MAXimum network resistance is = %7.2f Ohms \n", max ) ; printf( "\n The MINimum network resistance is = %7.2f Ohms \n", min ) ; temp_1 = pot * (min - max) ; temp_2 = 2 * (max - min) ; temp_3 = pot * pot * ( (max * max) - (2 * min * max) + (min * min) ) ; temp_4 = 4 * pot * ( (min * max * max) - (min * min * max) ) ; temp_5 = sqrt( temp_3 + temp_4 ) ; res_1 = (temp_1 + temp_5) / temp_2 ; printf( "\n The resistor in series with the pot, R1, is = %7.2f Ohms \n", res_1 ) ; res_2 = (res_1 * min) / (res_1 - min) ; printf( "\n The resistor in parallel, R2, is = %7.2f Ohms \n", res_2 ) ; }