Skip to content

Commit 3b7d67d

Browse files
author
neil.hamilton
committed
Add setting up of data buffers to ps6000aBlockExample.py
1 parent 7b21d85 commit 3b7d67d

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

ps6000aExamples/ps6000aBlockExample.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,30 @@
5959
print("timebase = ", timebase.value)
6060
print("sample interval =", timeInterval.value, "s")
6161

62+
# Set number of samples to be collected
63+
noOfPreTriggerSamples = 500000
64+
noOfPostTriggerSamples = 1000000
65+
nSamples = noOfPostTriggerSamples + noOfPreTriggerSamples
66+
67+
# Create buffers
68+
bufferAMax = (ctypes.c_int16 * nSamples)()
69+
bufferAMin = (ctypes.c_int16 * nSamples)() # used for downsampling which isn't in the scope of this example
70+
71+
# Set data buffers
72+
# handle = chandle
73+
# channel = channelA
74+
# bufferMax = bufferAMax
75+
# bufferMin = bufferAMin
76+
# nSamples = nSamples
77+
dataType = 2 # PICO_DATA_TYPE["PICO_INT16_T"]
78+
waveform = 1
79+
# downSample = 0
80+
action = 0x00000001 # PICO_ACTION["PICO_CLEAR_ALL"]
81+
status["setDataBuffers"] = ps.ps6000aSetDataBuffers(chandle, channelA, ctypes.byref(bufferAMax), ctypes.byref(bufferAMin), nSamples, dataType, waveform, 0, action)
82+
assert_pico_ok(status["setDataBuffers"])
83+
6284
# Run block capture
6385
# handle = chandle
64-
noOfPreTriggerSamples = 500
65-
noOfPostTriggerSamples = 1000000
6686
# timebase = timebase
6787
timeIndisposedMs = ctypes.c_double(0)
6888
# segmentIndex = 0

0 commit comments

Comments
 (0)