Skip to content

Commit d8e3044

Browse files
author
neil.hamilton
committed
Add functions for channel b in streaming example for ps6000a
1 parent 2daf8e6 commit d8e3044

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

ps6000aExamples/ps6000aStreamingModeExample.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@
3434
bandwidth = enums.PICO_BANDWIDTH_LIMITER["PICO_BW_FULL"]
3535
status["setChannelA"] = ps.ps6000aSetChannelOn(chandle, channelA, coupling, channelRange, 0, bandwidth)
3636
assert_pico_ok(status["setChannelA"])
37+
channelA = enums.PICO_CHANNEL["PICO_CHANNEL_B"]
38+
status["setChannelB"] = ps.ps6000aSetChannelOn(chandle, channelB, coupling, channelRange, 0, bandwidth)
39+
assert_pico_ok(status["setChannelB"])
3740

38-
# set channel B-H off
39-
for x in range(1, 7, 1):
41+
# set channel C-H off
42+
for x in range(2, 7, 1):
4043
channel = x
4144
status["setChannel", x] = ps.ps6000aSetChannelOff(chandle, channel)
4245
assert_pico_ok(status["setChannel", x])
@@ -61,6 +64,7 @@
6164
maxBuffers = 10
6265

6366
bufferA = ((ctypes.c_int16 * nSamples) * 10)()
67+
bufferB = ((ctypes.c_int16 * nSamples) * 10)()
6468

6569
print(bufferA)
6670
# Set data buffers
@@ -75,9 +79,13 @@
7579
clear = enums.PICO_ACTION["PICO_CLEAR_ALL"]
7680
add = enums.PICO_ACTION["PICO_ADD"]
7781
action = clear | add # PICO_ACTION["PICO_CLEAR_WAVEFORM_CLEAR_ALL"] | PICO_ACTION["PICO_ADD"]
78-
status["setDataBuffers"] = ps.ps6000aSetDataBuffer(chandle, channelA, ctypes.byref(bufferA[0]), nSamples, dataType,
82+
actionB = add
83+
status["setDataBuffersA"] = ps.ps6000aSetDataBuffer(chandle, channelA, ctypes.byref(bufferA[0]), nSamples, dataType,
7984
waveform, downSampleMode, action)
80-
assert_pico_ok(status["setDataBuffers"])
85+
assert_pico_ok(status["setDataBuffersA"])
86+
status["setDataBuffersB"] = ps.ps6000aSetDataBuffer(chandle, channelB, ctypes.byref(bufferA[0]), nSamples, dataType,
87+
waveform, downSampleMode, actionB)
88+
assert_pico_ok(status["setDataBuffersB"])
8189

8290
# Run streaming
8391
sampleInterval = ctypes.c_double(1)
@@ -90,13 +98,15 @@
9098
downSampleRatio, downSampleMode)
9199
assert_pico_ok(status["runStreaming"])
92100

93-
streamData = structs.PICO_STREAMING_DATA_INFO(channelA, downSampleRatio, dataType, 0, 0, 0, 0)
101+
streamData = (structs.PICO_STREAMING_DATA_INFO * 2)()
102+
streamData[0] = structs.PICO_STREAMING_DATA_INFO(channelA, downSampleRatio, dataType, 0, 0, 0, 0)
103+
streamData[1] = structs.PICO_STREAMING_DATA_INFO(channelB, downSampleRatio, dataType, 0, 0, 0, 0)
94104

95105
streamTrigger = structs.PICO_STREAMING_DATA_TRIGGER_INFO(0, 0, 0)
96106

97107
count = 1
98108

99-
actionB = add
109+
100110

101111
picoOk = PICO_STATUS["PICO_OK"]
102112

@@ -111,9 +121,12 @@
111121
else:
112122
count = count + 1
113123
if count <= maxBuffers:
114-
status["setDataBuffer"] = ps.ps6000aSetDataBuffer(chandle, channelA, ctypes.byref(bufferA[count - 1]),
124+
status["setDataBufferA"] = ps.ps6000aSetDataBuffer(chandle, channelA, ctypes.byref(bufferA[count - 1]),
125+
nSamples, dataType, waveform, downSampleMode, actionB)
126+
assert_pico_ok(status["setDataBufferA"])
127+
status["setDataBufferB"] = ps.ps6000aSetDataBuffer(chandle, channelB, ctypes.byref(bufferB[count - 1]),
115128
nSamples, dataType, waveform, downSampleMode, actionB)
116-
assert_pico_ok(status["setDataBuffer"])
129+
assert_pico_ok(status["setDataBufferB"])
117130
print(count)
118131

119132
print("streaming finished")
@@ -130,6 +143,8 @@
130143
for j in range(0, 9):
131144
A = bufferA[j]
132145
bufferAmV[j] = adc2mV(A, channelRange, maxADC)
146+
B = bufferB[j]
147+
bufferBmV[j] = adc2mV(B, channelRange, maxADC)
133148

134149
# Close the scope
135150
status["closeunit"] = ps.ps6000aCloseUnit(chandle)

0 commit comments

Comments
 (0)