|
63 | 63 | status["maximumValue"] = ps.ps5000aMaximumValue(chandle, ctypes.byref(maxADC)) |
64 | 64 | assert_pico_ok(status["maximumValue"]) |
65 | 65 |
|
66 | | -# Parameters |
67 | | -chA=0 # channel A |
68 | | -chB=1 # channel B |
69 | | -maxADC = ctypes.c_int16(32767) |
70 | | -NB=2 #NB=nConditions=nDirections=nChannelProperties |
71 | | -rg=2000 # range of voltage in millivolt |
72 | | -threshold=1000 |
73 | | -thresholdLower=0 |
74 | | -hyteresis=0 |
75 | | -window=False |
76 | | -direction=2 # Rising |
77 | | - |
78 | | -#CONDITIONS |
79 | | -conditions = (ps.PS5000A_CONDITION * NB)() |
80 | | -clear=0x00000001 |
81 | | -add=0x00000002 |
82 | | -cond_info=clear|add |
83 | | -a = ps.PS5000A_TRIGGER_STATE["PS5000A_CONDITION_TRUE"] |
84 | | -conditions[0]= ps.PS5000A_CONDITION(channelA, ps.PS5000A_TRIGGER_STATE["PS5000A_CONDITION_TRUE"]) |
85 | | -conditions[1]= ps.PS5000A_CONDITION(channelB, ps.PS5000A_TRIGGER_STATE["PS5000A_CONDITION_TRUE"]) |
86 | | -status["maximumValue_"] = ps.ps5000aMaximumValue(chandle, ctypes.byref(maxADC)) |
87 | | -assert_pico_ok(status["maximumValue_"]) |
88 | | -status["setTriggerChannelConditions_"] = ps.ps5000aSetTriggerChannelConditionsV2(chandle, |
89 | | - ctypes.byref(conditions), |
90 | | - NB, |
91 | | - cond_info) |
92 | | -assert_pico_ok(status["setTriggerChannelConditions_"]) |
93 | | - |
94 | | -# DIRECTIONS |
95 | | -if window==True: |
96 | | - th_mode=ps.PS5000A_THRESHOLD_MODE["PS5000A_WINDOW"] |
97 | | -else: |
98 | | - th_mode=ps.PS5000A_THRESHOLD_MODE["PS5000A_LEVEL"] |
99 | | -triggerDirections=(ps.PS5000A_DIRECTION * NB)() |
100 | | -triggerDirections[0] = ps.PS5000A_DIRECTION(chA, direction, th_mode) |
101 | | -triggerDirections[1] = ps.PS5000A_DIRECTION(chB, direction, th_mode) |
102 | | -status["setTriggerChannelDirections_"] = ps.ps5000aSetTriggerChannelDirectionsV2(chandle, ctypes.byref(triggerDirections), NB) |
103 | | -assert_pico_ok(status["setTriggerChannelDirections_"]) |
104 | | - |
105 | | -# PROPERTIES |
106 | | -thUpper = mV2adc(threshold, chARange, maxADC) |
107 | | -thLower = mV2adc(thresholdLower, chARange, maxADC) |
108 | | -hysteresis=0 |
109 | | -triggerProperties = (ps.PS5000A_TRIGGER_CHANNEL_PROPERTIES_V2 * NB)() |
110 | | -triggerProperties[0] = ps.PS5000A_TRIGGER_CHANNEL_PROPERTIES_V2(thUpper, |
111 | | - hysteresis, |
112 | | - thLower, |
113 | | - hysteresis, |
114 | | - 0) |
115 | | -triggerProperties[1] = ps.PS5000A_TRIGGER_CHANNEL_PROPERTIES_V2(thUpper, |
116 | | - hysteresis, |
117 | | - thLower, |
118 | | - hysteresis, |
119 | | - 1) |
120 | | -status["setTriggerChannelProperties_"] = ps.ps5000aSetTriggerChannelPropertiesV2(chandle, ctypes.byref(triggerProperties), NB, 0) |
121 | | -assert_pico_ok(status["setTriggerChannelProperties_"]) |
| 66 | +# Set up simple trigger |
| 67 | +# handle = chandle |
| 68 | +# enabled = 1 |
| 69 | +source = ps.PS5000A_CHANNEL["PS5000A_CHANNEL_A"] |
| 70 | +threshold = int(mV2adc(500,chARange, maxADC)) |
| 71 | +# direction = PS5000A_RISING = 2 |
| 72 | +# delay = 0 s |
| 73 | +# auto Trigger = 1000 ms |
| 74 | +status["trigger"] = ps.ps5000aSetSimpleTrigger(chandle, 1, source, threshold, 2, 0, 1000) |
| 75 | +assert_pico_ok(status["trigger"]) |
122 | 76 |
|
123 | 77 | # Set number of pre and post trigger samples to be collected |
124 | 78 | preTriggerSamples = 2500 |
|
0 commit comments