示例#1
0
    def set_trigger(self,
                    channel_name,
                    threshold=0.,
                    direction='RISING',
                    is_enabled=True,
                    delay=0,
                    auto_trigger=0):
        """Set the oscilloscope trigger condition.

        :param channel_name: the source channel for the trigger (e.g. 'A')
        :param threshold: the trigger threshold (in V)
        :param direction: the direction in which the signal must move to cause
            a trigger
        :param is_enabled: (boolean) enable or disable the trigger
        :param delay: the delay between the trigger occuring and the start of
            capturing data, in number of sample periods
        :param auto_trigger: the maximum amount of time to wait for a trigger
            before starting capturing data in miliseconds

        The direction parameter can take values of 'ABOVE', 'BELOW', 'RISING',
        'FALLING' or 'RISING_OR_FALLING'.
        """
        channel = _get_channel_from_name(channel_name)
        threshold = self._rescale_V_to_adc(channel_name, threshold)
        direction = _get_trigger_direction_from_name(direction)
        assert_pico_ok(
            ps.ps3000aSetSimpleTrigger(self._handle, is_enabled, channel,
                                       threshold, direction, delay,
                                       auto_trigger))
示例#2
0
 def setTrigger(self,
                channel,
                enable=1,
                threshold=1024,
                direction=3,
                delay=0,
                autoTrigger_ms=5000):
     # Sets up single trigger
     # Handle = Chandle
     # Source = ps3000A_channel_B = 0
     # Enable = 0
     # Threshold = 1024 ADC counts
     # Direction = ps3000A_Falling = 3
     # Delay = 0
     # autoTrigger_ms = 1000
     self.status["trigger"] = ps.ps3000aSetSimpleTrigger(
         self.chandle, channel, enable, threshold, direction, delay,
         autoTrigger_ms)
     assert_pico_ok(self.status["trigger"])
# 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)

# Sets up single trigger
# Handle = Chandle
# Enable = 0
# Source = ps3000A_channel_A = 0
# Threshold = 1024 ADC counts
# Direction = ps3000A_Falling = 3
# Delay = 0
# autoTrigger_ms = 1000
status["trigger"] = ps.ps3000aSetSimpleTrigger(chandle, 1, 0, 1024, 3, 0, 1000)

# Setting the number of sample to be collected
preTriggerSamples = 40000
postTriggerSamples = 40000
maxsamples = preTriggerSamples + postTriggerSamples

# Create buffers ready for assigning pointers for data collection
bufferAMax = (ctypes.c_int16 * maxsamples)()
bufferAMin = (ctypes.c_int16 * maxsamples)()

# Setting the data buffer location for data collection from channel A
# Handle = Chandle
# source = ps3000A_channel_A = 0
# Buffer max = ctypes.byref(bufferAMax)
# Buffer min = ctypes.byref(bufferAMin)