Skip to content

Commit 928ab5a

Browse files
author
neil.hamilton
committed
Add all advanced trigger functions to ps6000BlockAdvancedTriggerExample.py
1 parent d87d7ac commit 928ab5a

File tree

1 file changed

+41
-6
lines changed

1 file changed

+41
-6
lines changed

ps6000Examples/ps6000BlockAdvancedTriggerExample.py

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#
2-
# Copyright (C) 2018 Pico Technology Ltd. See LICENSE file for terms.
2+
# Copyright (C) 2018-2020 Pico Technology Ltd. See LICENSE file for terms.
33
#
4-
# PS6000 BLOCK MODE EXAMPLE
5-
# This example opens a 6000 driver device, sets up two channels and a trigger then collects a block of data.
4+
# PS6000 BLOCK MODE ADVANCED TRIGGER EXAMPLE
5+
# This example opens a 6000 driver device, sets up two channels and a level drop out advanced trigger then collects a block of data.
66
# This data is then plotted as mV against time in ns.
77

88
import ctypes
@@ -45,16 +45,51 @@
4545
assert_pico_ok(status["setChB"])
4646

4747
# Set up level drop out tirgger on A
48-
conditions = ps.PS6000_TRIGGER_CONDITIONS(ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_TRUE"],
48+
triggerConditions = ps.PS6000_TRIGGER_CONDITIONS(ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_TRUE"],
4949
ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"],
5050
ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"],
5151
ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"],
5252
ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"],
5353
ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"],
5454
ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_TRUE"])
55-
nConditions = 1
55+
nTriggerConditions = 1
5656

57-
status["setTriggerChannelConditions"] = ps.ps6000SetTriggerChannelConditions(chandle, ctypes.byref(conditions), nConditions)
57+
status["setTriggerChannelConditions"] = ps.ps6000SetTriggerChannelConditions(chandle, ctypes.byref(triggerConditions), nTriggerConditions)
58+
assert_pico_ok(status["setTriggerChannelConditions"])
59+
60+
status["setTriggerChannelDirections"] = ps.ps6000SetTriggerChannelDirections(chandle, ps.PS6000_THRESHOLD_DIRECTION["PS6000_RISING_OR_FALLING"], ps.PS6000_THRESHOLD_DIRECTION["PS6000_NONE"],
61+
ps.PS6000_THRESHOLD_DIRECTION["PS6000_NONE"], ps.PS6000_THRESHOLD_DIRECTION["PS6000_NONE"]. ps.PS6000_THRESHOLD_DIRECTION["PS6000_NONE"],
62+
ps.PS6000_THRESHOLD_DIRECTION[PS6000_NONE"])
63+
assert_pico_ok(status["setTriggerChannelDirections"])
64+
65+
maxADC = ctypes.c_int16(32512)
66+
threshold = mV2adc(109.2, chARange, maxADC)
67+
hysteresis = mV2adc(109.2 * 0.015), chARange, maxADC
68+
channelProperties = ps.PS6000_TRIGGER_CHANNEL_PROPERTIES(threshold,
69+
hysteresis,
70+
threshold,
71+
hysteresis,
72+
ps.PS6000_CHANNEL["PS6000_CHANNEL_A"],
73+
ps.PS6000_THRESHOLD_MODE["PS6000_LEVEL"])
74+
nChannelProperties = 1
75+
auxOutputEnable = 0
76+
autoTriggerMilliseconds = 1000
77+
status["setTriggerChannelProperties"] = ps.ps6000SetTriggerChannelProperties(chandle, ctypes.byref(channelProperties), nChannelProperties, auxOutputEnable, autoTriggerMilliseconds)
78+
assert_pico_ok(status["setTriggerChannelProperties"])
79+
80+
pwqConditions = ps.PS6000_PWQ_CONDTIONS(ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_TRUE"],
81+
ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"],
82+
ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"],
83+
ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"],
84+
ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"],
85+
ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"])
86+
nPwqConditions = 1
87+
direction = ps.PS6000_THRESHOLD_DIRECTION["PS6000_RISING_OR_FALLING"]
88+
lower = 390625 #samples at timebase 8 is 10 ms
89+
upper = lower
90+
type = ps.PS6000_PULSE_WIDTH_TYPE["PS6000_PW_TYPE_GREATER_THAN"]
91+
status["setPulseWidthQualifier"] = ps.ps6000SetPulseWidthQualifier(chandle, ctypes.byref(pwqConditions), nPwqConditions, direction, lower, upper, type)
92+
assert_pico_ok(status["setPulseWidthQualifier"])
5893

5994
# Set number of pre and post trigger samples to be collected
6095
preTriggerSamples = 2500

0 commit comments

Comments
 (0)