PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
Any help would be very appreciated
# Create status ready for use
status = {}
# Open 2000 series PicoScope
# 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
chARange = 2
status["setChA"] = ps.ps2000_set_channel(chandle, 0, 1, 0, chARange)
assert_pico2000_ok(status["setChA"])
status["setChB"] = ps.ps2000_set_channel(chandle, 1, 0, 0, chARange)
assert_pico2000_ok(status["setChB"])
#Set advanced trigger channel conditions
triggerConditions = ps.PS2000_TRIGGER_CONDITIONS(1,0,0,0,0,1) #only channel A and a pulse width qualifier
status["ps2000SetAdvTriggerChannelConditions"] = ps.ps2000SetAdvTriggerChannelConditions(chandle,ctypes.byref(triggerConditions), 1)
assert_pico2000_ok(status["ps2000SetAdvTriggerChannelConditions"])
# Pulse height trigger
thrMajor = 20 #mV
thrMajorBit = int(2**16 * (thrMajor)/100)
hysteresis = int(2.5 /100 * thrMajorBit )
thresholdMode = ps.PS2000_THRESHOLD_MODE["PS2000_LEVEL"]
triggerProperties = ps.PS2000_TRIGGER_CHANNEL_PROPERTIES(thrMajorBit,0,hysteresis,0,thresholdMode)
# Set advanced trigger channel properties
status["ps2000SetAdvTriggerChannelProperties"] = ps.ps2000SetAdvTriggerChannelProperties(chandle, ctypes.byref(triggerProperties),1, 0)
assert_pico2000_ok(status["ps2000SetAdvTriggerChannelProperties"])
# Set advanced trigger channel directions
triggerDirection = ps.PS2000_THRESHOLD_DIRECTION["PS2000_THRESHOLD_DIRECTION_RISING"]
status["ps2000SetAdvTriggerChannelDirections"] = ps.ps2000SetAdvTriggerChannelDirections(chandle,triggerDirection,0,0,0,0)
assert_pico2000_ok(status["ps2000SetAdvTriggerChannelDirections"])
#Set pulse width qualifier
pwqConditions = ps.tPS2000PwqConditions(1,0,0,0,0)
pwqDirections = ps.PS2000_THRESHOLD_DIRECTION["PS2000_THRESHOLD_DIRECTION_RISING"]
pwqProperties = ps.PS2000_PULSE_WIDTH_TYPE["PS2000_PW_TYPE_GREATER_THAN"]
PW_lowerlim = ctypes.c_uint32(20000)
PW_upperlim = ctypes.c_uint32(0)
status["setPulseWidthQualifier"] = ps.ps2000SetPulseWidthQualifier(chandle, ctypes.byref(pwqConditions), 1, pwqDirections, PW_lowerlim, PW_upperlim, pwqProperties)
assert_pico2000_ok(status["setPulseWidthQualifier"])