29 lines
815 B
C
29 lines
815 B
C
/*max_functions.c*/
|
|
|
|
#include"max_functions.h"
|
|
|
|
void set_output_voltage(double setpoint_voltage, ESeries E_resistors) {
|
|
|
|
double R_high_resistance = 0.0;
|
|
double R_low_resistance = 0.0;
|
|
|
|
//start at 10k for low resistor and at 1R for high resistor
|
|
int R_high_decade = 0;
|
|
int R_low_decade = 4;
|
|
|
|
// voltage computed from resistor configuration used to compare new result to previous optimum
|
|
double output_voltage = 0.0;
|
|
|
|
// set the max array index for given e series
|
|
ESeriesMaxValue max_value = get_E_MAX(E_resistors);
|
|
|
|
/*
|
|
* start at minimum given Rlow from datasheet and select optimal Rhigh for given Rlow and Vout.
|
|
* do this for all possible Rlows and choose the optimal combination
|
|
* (minimize |setpoint_voltage - output_voltage|)
|
|
*/
|
|
for () {
|
|
|
|
}
|
|
}
|