PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
channelA = ps.PS5000A_CHANNEL["PS5000A_CHANNEL_A"]
channelB = ps.PS5000A_CHANNEL["PS5000A_CHANNEL_"]
dir = ps.PS5000A_THRESHOLD_DIRECTION[PS5000A_RISING]
mode = ps.PS5000A_THRESHOLD_MODE["PS5000A_LEVEL"]
state_true = ps.PS5000A_TRIGGER_STATE["PS5000A_CONDITION_TRUE"]
clear = 0b00000001
add = 0b00000010
clearadd = 0b00000011
trigConditionA = [ps.PS5000A_CONDITION(channelA, state_true]
trigPropertiesA = [ps.PS5000A_TRIGGER_CHANNEL_PROPERTIES_V2(thresholdA, 0, thresholdA, 0, channelA)]
trigDirectionA = [ps.PS5000A_DIRECTION(channelA, dir, mode)]
trigConditionB = [ps.PS5000A_CONDITION(channelB, state_true)]
trigPropertiesB = [ps.PS5000A_TRIGGER_CHANNEL_PROPERTIES_V2(thresholdB, 0, thresholdB, 0, channelB)]
trigDirectionB = [ps.PS5000A_DIRECTION(channelB, dir, mode)]
assert_pico_ok(ps.ps5000aSetTriggerChannelPropertiesV2(self._handle, ctypes.byref(trigPropertiesA[0]), 1, 0))
assert_pico_ok(ps.ps5000aSetTriggerChannelPropertiesV2(self._handle, ctypes.byref(trigPropertiesB[0]), 1, 0))
assert_pico_ok(ps.ps5000aSetTriggerChannelConditionsV2(self._handle, ctypes.byref(trigConditionA[0]), 1, clearadd))
assert_pico_ok(ps.ps5000aSetTriggerChannelConditionsV2(self._handle, ctypes.byref(trigConditionB[0]), 1, add))
assert_pico_ok(ps.ps5000aSetTriggerChannelDirectionsV2(self._handle, ctypes.byref(trigDirectionA[0]), 1))
assert_pico_ok(ps.ps5000aSetTriggerChannelDirectionsV2(self._handle, ctypes.byref(trigDirectionB[0]), 1))
Code: Select all
channelA = ps.PS5000A_CHANNEL["PS5000A_CHANNEL_A"]
channelB = ps.PS5000A_CHANNEL["PS5000A_CHANNEL_B"]
dir = ps.PS5000A_THRESHOLD_DIRECTION[PS5000A_RISING]
mode = ps.PS5000A_THRESHOLD_MODE["PS5000A_LEVEL"]
Direction2 = ps.PS5000A_DIRECTION*2 # see ctypes docs
trigDirectionAB = Direction2(ps.PS5000A_DIRECTION(channelA, dir, mode),
ps.PS5000A_DIRECTION(channelB, dir, mode))
thresholdA = self._rescale_V_to_adc('A', threshold)
thresholdB = self._rescale_V_to_adc('B', threshold)
Property2 = ps.PS5000A_TRIGGER_CHANNEL_PROPERTIES_V2*2
trigPropertiesAB = \
Property2(ps.PS5000A_TRIGGER_CHANNEL_PROPERTIES_V2(thresholdA,
0, 0, 0, channelA),
ps.PS5000A_TRIGGER_CHANNEL_PROPERTIES_V2(thresholdB,
0, 0, 0, channelB))
state_true = ps.PS5000A_TRIGGER_STATE["PS5000A_CONDITION_TRUE"]
trigConditionA = ps.PS5000A_CONDITION(channelA, state_true)
trigConditionB = ps.PS5000A_CONDITION(channelB, state_true)
# Multiple directions/properties: logical OR
assert_pico_ok(ps.ps5000aSetTriggerChannelDirectionsV2(self._handle,
ctypes.byref(trigDirectionAB), 2))
assert_pico_ok(ps.ps5000aSetTriggerChannelPropertiesV2(self._handle,
ctypes.byref(trigPropertiesAB), 2, 0))
clear = 1 # 0b00000001
add = 2 # 0b00000010
# Multiple conditions: Logical AND; Multiple calls: logical OR
assert_pico_ok(ps.ps5000aSetTriggerChannelConditionsV2(self._handle,
ctypes.byref(trigConditionA), 1, (clear+add)))
assert_pico_ok(ps.ps5000aSetTriggerChannelConditionsV2(self._handle,
ctypes.byref(trigConditionB), 1, add))
assert_pico_ok(ps.ps5000aSetAutoTriggerMicroSeconds(self._handle, 0))