|
56 | 56 |
|
57 | 57 | # Set up dropout trigger |
58 | 58 | # set trigger condtions for channel A and pulse width qualifier |
59 | | -conditions[1] = ps.PS4000A_CONDITION(ps.PS4000A_CHANNEL["PS4000A_CHANNEL_A"], ps.PS4000A_TRIGGER_STATE["PS4000A_TRUE"]) |
60 | | -conditions[2] = ps.PS4000A_CONDITION(ps.PS4000A_CHANNEL["PS4000A__PULSE_WIDTH_SOURCE"],ps.PS4000A_TRIGGER_STATE["PS4000A_TRUE"]) |
| 59 | +conditions =[ps.PS4000A_CONDITION() for i in range (2)] |
| 60 | +print(conditions) |
| 61 | +conditions[0].source = ps.PS4000A_CHANNEL["PS4000A_CHANNEL_A"] |
| 62 | +conditions[0].condition = ps.PS4000A_TRIGGER_STATE["PS4000A_TRUE"] |
| 63 | +conditions[1].source = ps.PS4000A_CHANNEL["PS4000A_PULSE_WIDTH_SOURCE"] |
| 64 | +conditions[1].condition = ps.PS4000A_TRIGGER_STATE["PS4000A_TRUE"] |
| 65 | + |
61 | 66 | nConditions = 2 |
62 | 67 | info = ps.PS4000A_CONDITIONS_INFO["PS4000A_ADD"] |
63 | 68 | status["setTriggerChannelConditions"] = ps.ps4000aSetTriggerChannelConditions(chandle, ctypes.byref(conditions), nConditions, info) |
|
67 | 72 | directions = ps.PS4000A_DIRECTION(ps.PS4000A_CHANNEL["PS4000A_CHANNEL_A"], ps.PS4000A_THRESHOLD_DIRECTION["PS4000A_ENTER"]) |
68 | 73 | nDirections = 1 |
69 | 74 | status["setTriggerChannelDirections"] = ps.ps4000aSetTriggerChannelDirections(chandle, ctypes.byref(directions), nDirections) |
| 75 | +assert_pico_ok(status["setTriggerChannelDirections"]) |
70 | 76 |
|
71 | 77 | # find maximum ADC count value |
72 | 78 | # handle = chandle |
|
79 | 85 | nChannelProperties = 1 |
80 | 86 | autoTriggerms = 10000 |
81 | 87 | status["setTriggerChannelProperties"] = ps.ps4000aSetTriggerChannelProperties(chandle, ctypes.byref(channelProperties), nChannelProperties, 0, autoTriggerms) |
| 88 | +assert_pico_ok(status["setTriggerChannelProperties"]) |
| 89 | + |
| 90 | +# set pulse width qualifier conditions |
| 91 | +pwqConditions = conditions[1] |
| 92 | +pwqNConditions = 1 |
| 93 | +status["setPulseWidthQualifierConditions"] = ps.ps4000aSetPulseWidthQualifierConditions(chandle, ctypes.byref(pwqConditions), pwqNConditions, info) |
| 94 | +assert_pico_ok(status["setPulseWidthQualifierConditions"]) |
| 95 | + |
| 96 | +# set pulse width qualifier properties |
| 97 | +direction = ps.PS4000A_DIRECTION[""] |
| 98 | +lower = 15 |
| 99 | +upper = 100 |
| 100 | +type = ps.PS4000A_PULSE_WIDTH_TYPE["PW_TYPE_IN_RANGE"] |
| 101 | +status["setPulseWidthQualifierProperties"] = ps.ps4000aSetPulseWidthQualifierProperties(chandle, direction, lower, upper, type) |
| 102 | +assert_pico_ok(status["setPulseWidthQualifierProperties"]) |
82 | 103 |
|
83 | 104 | # Set number of pre and post trigger samples to be collected |
84 | 105 | preTriggerSamples = 2500 |
|
0 commit comments