Skip to content

Commit b647b2f

Browse files
author
neil.hamilton
committed
Add plotting to ps6000aBlockExample.py
1 parent ef08d7d commit b647b2f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

ps6000aExamples/ps6000aBlockExample.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,25 @@
109109
status["getValues"] = ps.ps6000aGetValues(chandle, 0, ctypes.byref(noOfSamples), 1, downSampleMode, 0, ctypes.byref(overflow))
110110
assert_pico_ok(status["getValues"])
111111

112+
# get max ADC value
113+
# handle = chandle
114+
minADC = ctypes.c_int16()
115+
maxADC = ctypes.c_int16()
116+
status["getAdcLimits"] = ps.ps6000aGetAdcLimits(chandle, resolution, ctypes.byref(minADC), ctypes.byref(maxADC))
117+
assert_pico_ok(status["getAdcLimits"])
118+
119+
# convert ADC counts data to mV
120+
adc2mVChAMax = adc2mV(bufferAMax, channelRange, maxADC)
121+
122+
# Create time data
123+
time = np.linspace(0, (nSamples) * timeInterval.value * 1000000000, nSamples)
124+
125+
# plot data from channel A and B
126+
plt.plot(time, adc2mVChAMax[:])
127+
plt.xlabel('Time (ns)')
128+
plt.ylabel('Voltage (mV)')
129+
plt.show()
130+
112131
# Close the scope
113132
status["closeunit"] = ps.ps6000aCloseUnit(chandle)
114133
assert_pico_ok(status["closeunit"])

0 commit comments

Comments
 (0)