def hysteresis_threshold_ratios_opendrain(r1, r2, rh): """ Same as hysteresis_threshold_ratios(), but for open-drain comparators. In contrast to hysteresis_threshold_ratios(), ignores rh for the upper threshold. Parameters ---------- r1 : float or EngineerIO string The top resistor of the divider r2 : float or EngineerIO string The bottom resistor of the divider rh : float or EngineerIO string The hysteresis resistor of the divider """ # Normalize inputs r1 = normalize_numeric(r1) r2 = normalize_numeric(r2) rh = normalize_numeric(rh) # Compute r1, r2 in parallel with rh r2rh = parallel_resistors(r2, rh) # Compute thresholds thl = unloaded_ratio(r1, r2rh) thu = unloaded_ratio(r1, r2) return (thl, thu)
def hysteresis_threshold_ratios_opendrain(r1, r2, rh): """ Same as hysteresis_threshold_ratios(), but for open-drain comparators. In contrast to hysteresis_threshold_ratios(), ignores rh for the upper threshold. Parameters ---------- r1 : float or EngineerIO string The top resistor of the divider r2 : float or EngineerIO string The bottom resistor of the divider rh : float or EngineerIO string The hysteresis resistor of the divider """ # Normalize inputs r1 = normalize_numeric(r1) r2 = normalize_numeric(r2) rh = normalize_numeric(rh) # Compute r1, r2 in parallel with rh r2rh = parallel_resistors(r2, rh) # Compute thresholds thl = voltage_divider_ratio(r1, r2rh) thu = voltage_divider_ratio(r1, r2) return (thl, thu)
def hysteresis_threshold_ratios(r1, r2, rh): """ Calculates hysteresis threshold factors for push-pull comparators Assumes that r1 and r2 are used to divide Vcc using a fixed ratio to obtain a threshold voltage. Additionally, Rh sources or sinks current to the threshold voltage, depending on the current state of the comparator. Additionally it it assumed that the same voltage (Vcc) that feeds the R1+R2 divider is output from the comparator and input to Rh. This function computes the (lower, upper) division ratios by assuming rh is set either parallel with R1 (upper) or with R2 (lower). Returns a tuple (lower, upper) containing floats representing the division ratios. Parameters ---------- r1 : float or EngineerIO string The top resistor of the divider r2 : float or EngineerIO string The bottom resistor of the divider rh : float or EngineerIO string The hysteresis resistor of the divider """ # Normalize inputs r1 = normalize_numeric(r1) r2 = normalize_numeric(r2) rh = normalize_numeric(rh) # Compute r1, r2 in parallel with rh r1rh = parallel_resistors(r1, rh) r2rh = parallel_resistors(r2, rh) # Compute thresholds thl = unloaded_ratio(r1, r2rh) thu = unloaded_ratio(r1rh, r2) return (thl, thu)
def hysteresis_threshold_ratios(r1, r2, rh): """ Calculates hysteresis threshold factors for push-pull comparators Assumes that r1 and r2 are used to divide Vcc using a fixed ratio to obtain a threshold voltage. Additionally, Rh sources or sinks current to the threshold voltage, depending on the current state of the comparator. Additionally it it assumed that the same voltage (Vcc) that feeds the R1+R2 divider is output from the comparator and input to Rh. This function computes the (lower, upper) division ratios by assuming rh is set either parallel with R1 (upper) or with R2 (lower). Returns a tuple (lower, upper) containing floats representing the division ratios. Parameters ---------- r1 : float or EngineerIO string The top resistor of the divider r2 : float or EngineerIO string The bottom resistor of the divider rh : float or EngineerIO string The hysteresis resistor of the divider """ # Normalize inputs r1 = normalize_numeric(r1) r2 = normalize_numeric(r2) rh = normalize_numeric(rh) # Compute r1, r2 in parallel with rh r1rh = parallel_resistors(r1, rh) r2rh = parallel_resistors(r2, rh) # Compute thresholds thl = voltage_divider_ratio(r1, r2rh) thu = voltage_divider_ratio(r1rh, r2) return (thl, thu)