Skip to content

Commit 9bf5404

Browse files
author
neil.hamilton
committed
resolve issues with getting streaming data back
1 parent 74385f4 commit 9bf5404

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

ps6000aExamples/ps6000aStreamingModeExample.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@
7878
clear = enums.PICO_ACTION["PICO_CLEAR_ALL"]
7979
add = enums.PICO_ACTION["PICO_ADD"]
8080
action = clear | add # PICO_ACTION["PICO_CLEAR_WAVEFORM_CLEAR_ALL"] | PICO_ACTION["PICO_ADD"]
81-
actionB = add
81+
actionAdd = add
8282
status["setDataBuffersA"] = ps.ps6000aSetDataBuffer(chandle, channelA, ctypes.byref(bufferA[0]), nSamples, dataType,
8383
waveform, downSampleMode, action)
8484
assert_pico_ok(status["setDataBuffersA"])
85-
status["setDataBuffersB"] = ps.ps6000aSetDataBuffer(chandle, channelB, ctypes.byref(bufferA[0]), nSamples, dataType,
86-
waveform, downSampleMode, actionB)
85+
status["setDataBuffersB"] = ps.ps6000aSetDataBuffer(chandle, channelB, ctypes.byref(bufferB[0]), nSamples, dataType,
86+
waveform, downSampleMode, actionAdd)
8787
assert_pico_ok(status["setDataBuffersB"])
8888

8989
# Run streaming
@@ -98,8 +98,8 @@
9898
assert_pico_ok(status["runStreaming"])
9999

100100
streamData = (structs.PICO_STREAMING_DATA_INFO * 2)()
101-
streamData[0] = structs.PICO_STREAMING_DATA_INFO(channelA, downSampleRatio, dataType, 0, 0, 0, 0)
102-
streamData[1] = structs.PICO_STREAMING_DATA_INFO(channelB, downSampleRatio, dataType, 0, 0, 0, 0)
101+
streamData[0] = structs.PICO_STREAMING_DATA_INFO(channelA, downSampleMode, dataType, 0, 0, 0, 0)
102+
streamData[1] = structs.PICO_STREAMING_DATA_INFO(channelB, downSampleMode, dataType, 0, 0, 0, 0)
103103

104104
streamTrigger = structs.PICO_STREAMING_DATA_TRIGGER_INFO(0, 0, 0)
105105

@@ -121,14 +121,18 @@
121121
count = count + 1
122122
if count <= maxBuffers:
123123
status["setDataBufferA"] = ps.ps6000aSetDataBuffer(chandle, channelA, ctypes.byref(bufferA[count - 1]),
124-
nSamples, dataType, waveform, downSampleMode, actionB)
124+
nSamples, dataType, waveform, downSampleMode, actionAdd)
125125
assert_pico_ok(status["setDataBufferA"])
126126
status["setDataBufferB"] = ps.ps6000aSetDataBuffer(chandle, channelB, ctypes.byref(bufferB[count - 1]),
127-
nSamples, dataType, waveform, downSampleMode, actionB)
127+
nSamples, dataType, waveform, downSampleMode, actionAdd)
128128
assert_pico_ok(status["setDataBufferB"])
129129
print(count)
130-
130+
ps.ps6000aStop(chandle)
131+
noOfStreamedSamples=ctypes.c_uint64()
132+
ps.ps6000aNoOfStreamingValues(chandle,ctypes.byref(noOfStreamedSamples))
131133
print("streaming finished")
134+
print(noOfStreamedSamples.value)
135+
132136

133137
# get max ADC value
134138
# handle = chandle
@@ -138,6 +142,9 @@
138142
assert_pico_ok(status["getAdcLimits"])
139143

140144
# convert ADC counts data to mV
145+
plt.plot(bufferA[5])
146+
plt.plot(bufferB[9])
147+
plt.show()
141148
# bufferAmV = ((ctypes.c_int16 * nSamples) * 10)()
142149
# bufferBmV = ((ctypes.c_int16 * nSamples) * 10)()
143150
# for j in range(0, 9):

0 commit comments

Comments
 (0)