Skip to content

Commit ef08d7d

Browse files
author
neil.hamilton
committed
Add setting data buffers and retrieving data to ps6000aBlockExample.py
1 parent c696a0d commit ef08d7d

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

ps6000aExamples/ps6000aBlockExample.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@
7474
# bufferMax = bufferAMax
7575
# bufferMin = bufferAMin
7676
# 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)
77+
dataType = 1 # PICO_DATA_TYPE["PICO_INT16_T"]
78+
waveform = 0
79+
downSampleMode = 0x80000000 # PICO_RATIO_MODE["PICO_RATIO_MODE_RAW"]
80+
clear = 0x00000001 # PICO_ACTION["PICO_CLEAR_ALL"]
81+
add = 0x00000002 # PICO_ACTION["PICO_ADD"]
82+
action = clear|add # PICO_ACTION["PICO_CLEAR_WAVEFORM_CLEAR_ALL"] + PICO_ACTION["PICO_ADD"]
83+
status["setDataBuffers"] = ps.ps6000aSetDataBuffers(chandle, channelA, ctypes.byref(bufferAMax), ctypes.byref(bufferAMin), nSamples, dataType, waveform, downSampleMode, action)
8284
assert_pico_ok(status["setDataBuffers"])
8385

8486
# Run block capture
@@ -96,6 +98,16 @@
9698
check = ctypes.c_int16(0)
9799
while ready.value == check.value:
98100
status["isReady"] = ps.ps6000aIsReady(chandle, ctypes.byref(ready))
101+
102+
# Get data from scope
103+
# handle = chandle
104+
# startIndex = 0
105+
noOfSamples = ctypes.c_uint64(nSamples)
106+
# downSampleRatio = 1
107+
# segmentIndex = 0
108+
overflow = ctypes.c_int16(0)
109+
status["getValues"] = ps.ps6000aGetValues(chandle, 0, ctypes.byref(noOfSamples), 1, downSampleMode, 0, ctypes.byref(overflow))
110+
assert_pico_ok(status["getValues"])
99111

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

0 commit comments

Comments
 (0)