Skip to content

Commit 574e597

Browse files
author
neil.hamilton
committed
Update ps5000a.py aand ps5000aBlockAdvancedTriggerExample.py
1 parent f1735a3 commit 574e597

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

picosdk/ps5000a.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,14 @@ class PS5000A_DIGITAL_CHANNEL_DIRECTIONS(Structure):
187187
_fields_ = [("channel", c_int32),
188188
("direction", c_int32)]
189189

190+
190191
class PS5000A_DIRECTION(Structure):
191192
_pack_ = 1
192193
_fields_ = [("channel", c_int32),
193194
("direction", c_int32),
194195
("mode", c_int32)]
195196

197+
196198
class PS5000A_TRIGGER_CHANNEL_PROPERTIES_V2(Structure):
197199
_pack_ = 1
198200
_fields_ = [("thresholdUpper", c_int16),
@@ -201,6 +203,7 @@ class PS5000A_TRIGGER_CHANNEL_PROPERTIES_V2(Structure):
201203
("thresholdLowerHysteresis", c_uint16),
202204
("channel", c_int32)]
203205

206+
204207
class PS5000A_CONDITION (Structure):
205208
_pack_ = 1
206209
_fields_ = [("source", c_int32),

ps5000aExamples/ps5000aBlockAdvancedTriggerExample.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,26 @@
6464
assert_pico_ok(status["maximumValue"])
6565

6666
# Set up an advanced trigger
67-
67+
adcTriggerLevel = mV2adc(500, chARange, maxADC)
68+
triggerProperties = PS5000A_TRIGGER_CHANNEL_PROPERTIES_V2(adcTriggerLevel,
69+
10,
70+
0,
71+
10,
72+
ps.PS5000A_CHANNEL["PS5000A_CHANNEL_A"])
73+
74+
status["setTriggerChannelPropertiesV2"] = ps.ps5000aSetTriggerChannelPropertiesV2(chandle, triggerProperties, length(triggerProperties), 0)
75+
76+
triggerConditions = PS5000A_CONDITION(ps.PS5000A_CHANNEL["PS5000A_CHANNEL_A"],
77+
ps.PS5000A_TRIGGER_STATE["PS5000A_CONDITION_TRUE"])
78+
79+
clear = 1
80+
add = 2
81+
82+
status["setTriggerChannelConditionsV2"] = ps.ps5000aSetTriggerChannelConditionsV2(chandle, triggerConditions, length(triggerConditions), (clear + add))
83+
84+
triggerDirections = PS5000A_DIRECTION(ps.PS5000A_CHANNEL["PS5000A_CHANNEL_A"], ps.PS5000A_THRESHOLD_DIRECTION["PS5000A_RISING"], ps.PS5000A_THRESHOLD_MODE["PS5000A_LEVEL"])
85+
86+
status["setTriggerChannelDirections"] = ps5000aSetTriggerChannelDirectionsV2(chandle, triggerDirections, length(triggerDirections))
6887

6988

7089
# Set number of pre and post trigger samples to be collected

0 commit comments

Comments
 (0)