|
9 | 9 | import numpy as np |
10 | 10 | from picosdk.ps6000a import ps6000a as ps |
11 | 11 | from picosdk.PicoDeviceEnums import picoEnum as enums |
| 12 | +from picosdk.PicoDeviceStructs import picoStruct as struct |
12 | 13 | import matplotlib.pyplot as plt |
13 | | -from picosdk.functions import adc2mV, assert_pico_ok |
| 14 | +from picosdk.functions import mV2adc, adc2mV, assert_pico_ok |
14 | 15 |
|
15 | 16 | # Create chandle and status ready for use |
16 | 17 | chandle = ctypes.c_int16() |
|
25 | 26 | # Set channel A on |
26 | 27 | # handle = chandle |
27 | 28 | channelA = enums.PICO_CHANNEL["PICO_CHANNEL_A"] |
28 | | -coupling = enums.PICO_COUPLING["PICO_DC_OHM"] |
| 29 | +coupling = enums.PICO_COUPLING["PICO_DC_50OHM"] |
29 | 30 | channelRange = 5 |
30 | 31 | # analogueOffset = 0 V |
31 | 32 | bandwidth = enums.PICO_BANDWIDTH_LIMITER["PICO_BW_FULL"] |
|
53 | 54 | direction = enums.PICO_THRESHOLD_DIRECTION["PICO_RISING"] |
54 | 55 | # delay = 0 s |
55 | 56 | # autoTriggerMicroSeconds = 1000000 us |
56 | | -status["setSimpleTrigger"] = ps.ps6000aSetSimpleTrigger(chandle, 1, source, (mV2adc(100,channelRange,maxADC), direction, 0, 1000000) |
| 57 | +status["setSimpleTrigger"] = ps.ps6000aSetSimpleTrigger(chandle, 1, source, mV2adc(100,channelRange,maxADC), direction, 0, 1000000) |
57 | 58 | assert_pico_ok(status["setSimpleTrigger"]) |
58 | 59 |
|
59 | 60 | # Get fastest available timebase |
|
173 | 174 | status["getValues"] = ps.ps6000aGetValuesBulk(chandle, 0, ctypes.byref(noOfSamples),0, 9, 1, downSampleMode, ctypes.byref(overflow)) |
174 | 175 | assert_pico_ok(status["getValues"]) |
175 | 176 |
|
176 | | - |
| 177 | +# Handle = chandle |
| 178 | +# triggerInfo = (struct.PICO_TRIGGER_INFO * 10)() |
| 179 | +# Fromsegmentindex = 0 |
| 180 | +# Tosegementindex = 9 |
| 181 | +triggerInfo = (struct.PICO_TRIGGER_INFO * 10)() |
| 182 | + |
| 183 | +status["GetTriggerInfo"] = ps.ps6000aGetTriggerInfo(chandle, ctypes.byref(triggerInfo), 0, 10) |
| 184 | +assert_pico_ok(status["GetTriggerInfo"]) |
| 185 | +print("TimestampCounter values in samples (only relative timestamps one segment to the next)") |
| 186 | +# print("Timestamp samples for 2nd segment (index 1, from segment 0 to 1) = ", triggerInfo(1).timeStampCounter) |
| 187 | +print("Printing triggerInfo for segments-") |
| 188 | +for i in triggerInfo: |
| 189 | + print("segmentIndex is ", i.segmentIndex) |
| 190 | + print("PICO_STATUS is ", i.status) |
| 191 | + # print("triggerIndex is ", i.triggerIndex) |
| 192 | + # print("triggerTime is ", i.triggerTime) |
| 193 | + # print("timeUnits is ", i.timeUnits) |
| 194 | + print("timeStampCounter is ", i.timeStampCounter) |
| 195 | + print("-------------------------------") |
177 | 196 |
|
178 | 197 | # convert ADC counts data to mV |
179 | 198 | adc2mVChAMax = adc2mV(bufferAMax, channelRange, maxADC) |
|
0 commit comments