|
6 | 6 | # This data is then plotted as mV against time in ns. |
7 | 7 |
|
8 | 8 | import ctypes |
9 | | -import numpy as np |
| 9 | +# import numpy as np |
10 | 10 | from picosdk.ps6000a import ps6000a as ps |
11 | 11 | from picosdk.PicoDeviceEnums import picoEnum as enums |
12 | 12 | from picosdk.PicoDeviceStructs import picoStruct as structs |
|
40 | 40 | channel = x |
41 | 41 | status["setChannel", x] = ps.ps6000aSetChannelOff(chandle, channel) |
42 | 42 | assert_pico_ok(status["setChannel", x]) |
43 | | - |
44 | | - |
| 43 | + |
45 | 44 | # Set number of samples to be collected |
46 | 45 | noOfPreTriggerSamples = 100000 |
47 | 46 | noOfPostTriggerSamples = 900000 |
|
61 | 60 | # create buffers |
62 | 61 | maxBuffers = 10 |
63 | 62 |
|
64 | | - |
65 | | -bufferA = ((ctypes.c_int16 * nSamples)*10)() |
| 63 | +bufferA = ((ctypes.c_int16 * nSamples) * 10)() |
66 | 64 |
|
67 | 65 | print(bufferA) |
68 | 66 | # Set data buffers |
|
103 | 101 | picoOk = PICO_STATUS["PICO_OK"] |
104 | 102 |
|
105 | 103 | while count <= maxBuffers: |
106 | | - |
| 104 | + |
107 | 105 | status["getStreamingLatestValues"] = ps.ps6000aGetStreamingLatestValues(chandle, ctypes.byref(streamData), 1, |
108 | 106 | ctypes.byref(streamTrigger)) |
109 | | - |
| 107 | + |
110 | 108 | if status["getStreamingLatestValues"] == picoOk: |
111 | 109 | # do nothing |
112 | 110 | time.sleep(0.01) |
113 | 111 | else: |
114 | | - count = count+1 |
| 112 | + count = count + 1 |
115 | 113 | if count <= maxBuffers: |
116 | | - status["setDataBuffer"] = ps.ps6000aSetDataBuffer(chandle, channelA, ctypes.byref(bufferA[count-1]), |
117 | | - nSamples, dataType, waveform, downSampleMode, actionB) |
118 | | - assert_pico_ok(status["setDataBuffer"]) |
119 | | - print(count) |
| 114 | + status["setDataBuffer"] = ps.ps6000aSetDataBuffer(chandle, channelA, ctypes.byref(bufferA[count - 1]), |
| 115 | + nSamples, dataType, waveform, downSampleMode, actionB) |
| 116 | + assert_pico_ok(status["setDataBuffer"]) |
| 117 | + print(count) |
120 | 118 |
|
121 | 119 | print("streaming finished") |
122 | 120 |
|
|
128 | 126 | assert_pico_ok(status["getAdcLimits"]) |
129 | 127 |
|
130 | 128 | # convert ADC counts data to mV |
131 | | -bufferAmV=((ctypes.c_int16 * nSamples)*10)() |
| 129 | +bufferAmV = ((ctypes.c_int16 * nSamples) * 10)() |
132 | 130 | for j in range(0, 9): |
133 | | - bufferAmV[j] = adc2mV(bufferA[j], channelRange, maxADC) |
| 131 | + A = bufferA[j] |
| 132 | + bufferAmV[j] = adc2mV(A, channelRange, maxADC) |
134 | 133 |
|
135 | 134 | # Close the scope |
136 | 135 | status["closeunit"] = ps.ps6000aCloseUnit(chandle) |
|
0 commit comments