コード例 #1
0
    def meas_multi():
        measurements = []

        # unity gain test: Vplus=Vminus
        #        ls = [(x, x) for x in fullrange(config.pwm.start, config.pwm.end)]
        measurements += meas(None, pwm_values=None, phase='unity_gain')
        #        return measurements
        # determine good range for both input and ouput
        #        d2 = data.copy()
        #        d2['measurements'] = measurements
        low, high = calculate_good_interval(config, measurements, limit=10)
        #        print low, high
        Alow, Ahigh = low + 0.25 * (high - low), low + 0.75 * (high - low)

        low, high = map(an2pwm, [Alow, Ahigh])

        # input_swing test
        # output is always in good range if input is allowed
        avg = (low + high) / 2
        ls = [(math.ceil(x + (avg - x) / (A + 1)), x)
              for x in pwm_manager.range]
        measurements += meas(None, pwm_values=ls, phase='input_range')

        # output_swing test
        # input is always in good range
        loads = [(d.pin_load, d.Rload) for d in config.loads]
        for nr, R in [(None, None)] + loads:
            if nr is not None:
                mcu.pin.get(nr).write_mode(OUTPUT)
                mcu.pin.get(nr).write_digital_value(0)

            # Vminus is fixed in upper range
            Aplus = Circuit(A, Vminus=Ahigh, Vout=-20).Vplus
            ls = [(x, high) for x in fullrange(an2pwm(Aplus), high)]
            measurements += meas(R, pwm_values=ls, phase='output_swing')

            # to increase resolution
            for i in range(9):
                ls = [(x, high - i) for x in fullrange(an2pwm(Aplus), high)]
                measurements += meas(R, pwm_values=ls, phase='output_swing')

            # Vminus is fixed in lower range
            Aplus = Circuit(A, Vminus=Alow, Vout=1040).Vplus
            ls = [(x, low) for x in fullrange(low, an2pwm(Aplus))]

            # to increase resolution
            for i in range(9):
                ls = [(x, low + i) for x in fullrange(low, an2pwm(Aplus))]
                measurements += meas(R, pwm_values=ls, phase='output_swing')

            if nr is not None:
                mcu.pin.get(nr).reset()

        return measurements
コード例 #2
0
    def meas_multi():
        measurements = []

        # unity gain test: Vplus=Vminus
#        ls = [(x, x) for x in fullrange(config.pwm.start, config.pwm.end)]
        measurements += meas(None, pwm_values=None, phase='unity_gain')
#        return measurements
        # determine good range for both input and ouput
#        d2 = data.copy()
#        d2['measurements'] = measurements
        low, high = calculate_good_interval(config, measurements, limit=10)
#        print low, high
        Alow, Ahigh = low + 0.25 * (high - low), low + 0.75 * (high - low)

        low, high = map(an2pwm, [Alow, Ahigh])

        # input_swing test
        # output is always in good range if input is allowed
        avg = (low + high) / 2
        ls = [(
            math.ceil(x + (avg - x) / (A + 1)), x) for x in pwm_manager.range]
        measurements += meas(None, pwm_values=ls, phase='input_range')

        # output_swing test
        # input is always in good range
        loads = [(d.pin_load, d.Rload) for d in config.loads]
        for nr, R in [(None, None)] + loads:
            if nr is not None:
                mcu.pin.get(nr).write_mode(OUTPUT)
                mcu.pin.get(nr).write_digital_value(0)

            # Vminus is fixed in upper range
            Aplus = Circuit(A, Vminus=Ahigh, Vout= -20).Vplus
            ls = [(x, high) for x in fullrange(an2pwm(Aplus), high)]
            measurements += meas(R, pwm_values=ls, phase='output_swing')

            # to increase resolution
            for i in range(9):
                ls = [(x, high - i) for x in fullrange(an2pwm(Aplus), high)]
                measurements += meas(R, pwm_values=ls, phase='output_swing')

            # Vminus is fixed in lower range
            Aplus = Circuit(A, Vminus=Alow, Vout=1040).Vplus
            ls = [(x, low) for x in fullrange(low, an2pwm(Aplus))]

            # to increase resolution
            for i in range(9):
                ls = [(x, low + i) for x in fullrange(low, an2pwm(Aplus))]
                measurements += meas(R, pwm_values=ls, phase='output_swing')

            if nr is not None:
                mcu.pin.get(nr).reset()

        return measurements
コード例 #3
0
ファイル: pwm.py プロジェクト: ponty/electronic-measurements
 def __init__(self, config, pins):
     self.config = config
     self.pins = pins
     for p in pins:
         p.write_mode(OUTPUT)
         p.pwm.write_divisor(config.divisor)
     self.range = fullrange(self.config.start, self.config.end)