Exemplo n.º 1
0
    def set_channel(self, **kwargs):
        # Set up channel
        settings = {}  #in case of failure, settings is updated only at the end
        for key, current_value in self.settings.items():
            settings[key] = kwargs[key] if key in kwargs else current_value

        #checks
        check_kwargs_scope(**kwargs)

        # handle = chandle
        _channel = ctypes.c_int16(
            ps.PS2000_CHANNEL[channel_index[self.source]])
        _coupling_type = ctypes.c_int16(
            ps.PICO_COUPLING[coupling_type_index[settings['coupling_type']]])
        _chRange = ctypes.c_int16(
            ps.PS2000_VOLTAGE_RANGE[range_index[settings['chRange']]])
        self.status["setCh"] = ps.ps2000_set_channel(self.chandle, _channel, 1,
                                                     _coupling_type, _chRange)
        assert_pico2000_ok(self.status["setCh"])
        self.settings = settings
        self._chRange = _chRange
Exemplo n.º 2
0
# Returns handle to chandle for use in future API functions
status["openUnit"] = ps.ps2000_open_unit()
assert_pico2000_ok(status["openUnit"])

# Create chandle for use
chandle = ctypes.c_int16(status["openUnit"])

# Set up channel A
# handle = chandle
# channel = PS2000_CHANNEL_A = 0
# enabled = 1
# coupling type = PS2000_DC = 1
# range = PS2000_2V = 7
# analogue offset = 0 V
chARange = 7
status["setChA"] = ps.ps2000_set_channel(chandle, 0, 1, 1, chARange)
assert_pico2000_ok(status["setChA"])

# Set up channel B
# handle = chandle
# channel = PS2000_CHANNEL_B = 1
# enabled = 1
# coupling type = PS2000_DC = 1
# range = PS2000_2V = 7
# analogue offset = 0 V
chBRange = 7
status["setChB"] = ps.ps2000_set_channel(chandle, 1, 1, 1, chBRange)
assert_pico2000_ok(status["setChB"])

# Set up single trigger
# handle = chandle