|
1 | 1 | # |
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. |
3 | 3 | # |
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. |
6 | 6 | # This data is then plotted as mV against time in ns. |
7 | 7 |
|
8 | 8 | import ctypes |
|
45 | 45 | assert_pico_ok(status["setChB"]) |
46 | 46 |
|
47 | 47 | # 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"], |
49 | 49 | ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"], |
50 | 50 | ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"], |
51 | 51 | ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"], |
52 | 52 | ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"], |
53 | 53 | ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_DONT_CARE"], |
54 | 54 | ps.PS6000_TRIGGER_STATE["PS6000_CONDITION_TRUE"]) |
55 | | -nConditions = 1 |
| 55 | +nTriggerConditions = 1 |
56 | 56 |
|
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"]) |
58 | 93 |
|
59 | 94 | # Set number of pre and post trigger samples to be collected |
60 | 95 | preTriggerSamples = 2500 |
|
0 commit comments