示例#1
0
    def set_channel(self,
                    channel_name,
                    coupling_type='DC',
                    range_value=1,
                    offset=0,
                    is_enabled=True):
        """Set up input channels.

        :param channel_name: channel name ('A', 'B', etc.)
        :param coupling_type: 'AC' or 'DC' coupling
        :param range_value: (float) input voltage range in volts
        :param offset: analogue offset of the input signal
        :param is_enabled: enable or disable the channel
        :type is_enabled: boolean

        The input voltage range can be 10, 20, 50 mV, 100, 200, 500 mV, 1, 2,
        5 V or 10, 20, 50 V, but is given in volts. For example, a range of
        20 mV is given as 0.02.
        """
        channel = _get_channel_from_name(channel_name)
        coupling_type = _get_coupling_type_from_name(coupling_type)
        range = _get_range_from_value(range_value)
        assert_pico_ok(
            ps.ps3000aSetChannel(self._handle, channel, is_enabled,
                                 coupling_type, range, offset))

        self._input_voltage_ranges[channel_name] = float(range_value)
        self._input_offsets[channel_name] = float(offset)
        max_adc_value = ctypes.c_int16()
        assert_pico_ok(
            ps.ps3000aMaximumValue(self._handle, ctypes.byref(max_adc_value)))
        self._input_adc_ranges[channel_name] = max_adc_value.value
        self._channels_enabled[channel_name] = is_enabled
示例#2
0
 def setChannel(self,
                channel,
                enabled=1,
                coupling_type=1,
                Range=8,
                analogue_offset=0):
     # Set up channel A
     # handle = chandle
     # channel = PS3000A_CHANNEL_A = 0
     # enabled = 1
     # coupling type = PS3000A_DC = 1
     # range = PS3000A_10V = 8
     # analogue offset = 0 V
     self.chARange = Range
     self.status["setChA"] = ps.ps3000aSetChannel(self.chandle, channel,
                                                  enabled, coupling_type,
                                                  Range, analogue_offset)
     assert_pico_ok(self.status["setChA"])
示例#3
0
        # Changes the power input to "PICO_USB3_0_DEVICE_NON_USB3_0_PORT"
        status["ChangePowerSource"] = ps.ps3000aChangePowerSource(chandle, 286)
    else:
        raise

    assert_pico_ok(status["ChangePowerSource"])

# Set up channel A
# handle = chandle
# channel = PS3000A_CHANNEL_A = 0
# enabled = 1
# coupling type = PS3000A_DC = 1
# range = PS3000A_10V = 8
# analogue offset = 0 V
chARange = 8
status["setChA"] = ps.ps3000aSetChannel(chandle, 0, 1, 1, chARange, 0)
assert_pico_ok(status["setChA"])

# Finds the max ADC count
# Handle = chandle
# Value = ctypes.byref(maxADC)
maxADC = ctypes.c_int16()
status["maximumValue"] = ps.ps3000aMaximumValue(chandle, ctypes.byref(maxADC))
assert_pico_ok(status["maximumValue"])

# Set an advanced trigger
adcTriggerLevel = mV2adc(500, chARange, maxADC)

# set trigger channel properties
# handle = chandle
channelProperties = ps.PS3000A_TRIGGER_CHANNEL_PROPERTIES(
    assert_pico_ok(status["changePowerSource"])

enabled = 1
disabled = 0
analogue_offset = 0.0

# Set up channel A
# handle = chandle
# channel = PS3000A_CHANNEL_A = 0
# enabled = 1
# coupling type = PS3000A_DC = 1
# range = PS3000A_2V = 7
# analogue offset = 0 V
channel_range = ps.PS3000A_RANGE['PS3000A_2V']
status["setChA"] = ps.ps3000aSetChannel(
    chandle, ps.PS3000A_CHANNEL['PS3000A_CHANNEL_A'], enabled,
    ps.PS3000A_COUPLING['PS3000A_DC'], channel_range, analogue_offset)
assert_pico_ok(status["setChA"])

# Set up channel B
# handle = chandle
# channel = PS3000A_CHANNEL_B = 1
# enabled = 1
# coupling type = PS3000A_DC = 1
# range = PS3000A_2V = 7
# analogue offset = 0 V
status["setChB"] = ps.ps3000aSetChannel(
    chandle, ps.PS3000A_CHANNEL['PS3000A_CHANNEL_B'], enabled,
    ps.PS3000A_COUPLING['PS3000A_DC'], channel_range, analogue_offset)
assert_pico_ok(status["setChB"])