Skip to content

Commit b6fa638

Browse files
author
neil.hamilton
committed
Update trigger settings to use correct mV value
1 parent 52549eb commit b6fa638

File tree

5 files changed

+44
-35
lines changed

5 files changed

+44
-35
lines changed

ps6000aExamples/ps6000aBlockExample.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
channel = x
3838
status["setChannel",x] = ps.ps6000aSetChannelOff(chandle,channel)
3939
assert_pico_ok(status["setChannel",x])
40+
41+
# get max ADC value
42+
# handle = chandle
43+
minADC = ctypes.c_int16()
44+
maxADC = ctypes.c_int16()
45+
status["getAdcLimits"] = ps.ps6000aGetAdcLimits(chandle, resolution, ctypes.byref(minADC), ctypes.byref(maxADC))
46+
assert_pico_ok(status["getAdcLimits"])
4047

4148
# Set simple trigger on channel A, 1 V rising with 1 s autotrigger
4249
# handle = chandle
@@ -46,7 +53,7 @@
4653
direction = enums.PICO_THRESHOLD_DIRECTION["PICO_RISING"]
4754
# delay = 0 s
4855
# autoTriggerMicroSeconds = 1000000 us
49-
status["setSimpleTrigger"] = ps.ps6000aSetSimpleTrigger(chandle, 1, source, 100, direction, 0, 1000000)
56+
status["setSimpleTrigger"] = ps.ps6000aSetSimpleTrigger(chandle, 1, source, (mV2adc(100,channelRange,maxADC), direction, 0, 1000000)
5057
assert_pico_ok(status["setSimpleTrigger"])
5158

5259
# Get fastest available timebase
@@ -109,12 +116,7 @@
109116
status["getValues"] = ps.ps6000aGetValues(chandle, 0, ctypes.byref(noOfSamples), 1, downSampleMode, 0, ctypes.byref(overflow))
110117
assert_pico_ok(status["getValues"])
111118

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"])
119+
118120

119121
# convert ADC counts data to mV
120122
adc2mVChAMax = adc2mV(bufferAMax, channelRange, maxADC)

ps6000aExamples/ps6000aBlockExampleExtClk.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ def ExternalReferenceInteractions_callback(handle, statusCallback, reference):
6464
channel = x
6565
status["setChannel",x] = ps.ps6000aSetChannelOff(chandle,channel)
6666
assert_pico_ok(status["setChannel",x])
67+
68+
# get max ADC value
69+
# handle = chandle
70+
minADC = ctypes.c_int16()
71+
maxADC = ctypes.c_int16()
72+
status["getAdcLimits"] = ps.ps6000aGetAdcLimits(chandle, resolution, ctypes.byref(minADC), ctypes.byref(maxADC))
73+
assert_pico_ok(status["getAdcLimits"])
6774

6875
# Set simple trigger on channel A, 1 V rising with 1 s autotrigger
6976
# handle = chandle
@@ -73,7 +80,7 @@ def ExternalReferenceInteractions_callback(handle, statusCallback, reference):
7380
direction = enums.PICO_THRESHOLD_DIRECTION["PICO_RISING"]
7481
# delay = 0 s
7582
# autoTriggerMicroSeconds = 1000000 us
76-
status["setSimpleTrigger"] = ps.ps6000aSetSimpleTrigger(chandle, 1, source, 100, direction, 0, 1000000)
83+
status["setSimpleTrigger"] = ps.ps6000aSetSimpleTrigger(chandle, 1, source, (mV2adc(100,channelRange,maxADC), direction, 0, 1000000)
7784
assert_pico_ok(status["setSimpleTrigger"])
7885

7986
# Get fastest available timebase
@@ -142,12 +149,7 @@ def ExternalReferenceInteractions_callback(handle, statusCallback, reference):
142149
status["getValues"] = ps.ps6000aGetValues(chandle, 0, ctypes.byref(noOfSamples), 1, downSampleMode, 0, ctypes.byref(overflow))
143150
assert_pico_ok(status["getValues"])
144151

145-
# get max ADC value
146-
# handle = chandle
147-
minADC = ctypes.c_int16()
148-
maxADC = ctypes.c_int16()
149-
status["getAdcLimits"] = ps.ps6000aGetAdcLimits(chandle, resolution, ctypes.byref(minADC), ctypes.byref(maxADC))
150-
assert_pico_ok(status["getAdcLimits"])
152+
151153

152154
# convert ADC counts data to mV
153155
adc2mVChAMax = adc2mV(bufferAMax, channelRange, maxADC)

ps6000aExamples/ps6000aBlockMSOExample.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@
5555
status["setDigitalPortOff"] = ps.ps6000aSetDigitalPortOff(chandle,port2)
5656
assert_pico_ok(status["setDigitalPortOff"])
5757

58+
# get max ADC value
59+
# handle = chandle
60+
minADC = ctypes.c_int16()
61+
maxADC = ctypes.c_int16()
62+
status["getAdcLimits"] = ps.ps6000aGetAdcLimits(chandle, resolution, ctypes.byref(minADC), ctypes.byref(maxADC))
63+
assert_pico_ok(status["getAdcLimits"])
64+
5865
# Set simple trigger on channel A, 1 V rising with 1 s autotrigger
5966
# handle = chandle
6067
# enable = 1
@@ -63,7 +70,7 @@
6370
direction = enums.PICO_THRESHOLD_DIRECTION["PICO_RISING"]
6471
# delay = 0 s
6572
# autoTriggerMicroSeconds = 1000000 us
66-
status["setSimpleTrigger"] = ps.ps6000aSetSimpleTrigger(chandle, 1, source, 100, direction, 0, 1000000)
73+
status["setSimpleTrigger"] = ps.ps6000aSetSimpleTrigger(chandle, 1, source, (mV2adc(100,channelRange,maxADC), direction, 0, 1000000)
6774
assert_pico_ok(status["setSimpleTrigger"])
6875

6976
# Set number of samples to be collected
@@ -133,12 +140,7 @@
133140
status["getValues"] = ps.ps6000aGetValues(chandle, 0, ctypes.byref(noOfSamples), 1, downSampleMode, 0, ctypes.byref(overflow))
134141
assert_pico_ok(status["getValues"])
135142

136-
# get max ADC value
137-
# handle = chandle
138-
minADC = ctypes.c_int16()
139-
maxADC = ctypes.c_int16()
140-
status["getAdcLimits"] = ps.ps6000aGetAdcLimits(chandle, resolution, ctypes.byref(minADC), ctypes.byref(maxADC))
141-
assert_pico_ok(status["getAdcLimits"])
143+
142144

143145
# convert ADC counts data to mV
144146
adc2mVChAMax = adc2mV(bufferAMax, channelRange, maxADC)

ps6000aExamples/ps6000aRapidBlockExample.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
channel = x
3838
status["setChannel",x] = ps.ps6000aSetChannelOff(chandle,channel)
3939
assert_pico_ok(status["setChannel",x])
40+
41+
# get max ADC value
42+
# handle = chandle
43+
minADC = ctypes.c_int16()
44+
maxADC = ctypes.c_int16()
45+
status["getAdcLimits"] = ps.ps6000aGetAdcLimits(chandle, resolution, ctypes.byref(minADC), ctypes.byref(maxADC))
46+
assert_pico_ok(status["getAdcLimits"])
4047

4148
# Set simple trigger on channel A, 1 V rising with 1 s autotrigger
4249
# handle = chandle
@@ -46,7 +53,7 @@
4653
direction = enums.PICO_THRESHOLD_DIRECTION["PICO_RISING"]
4754
# delay = 0 s
4855
# autoTriggerMicroSeconds = 1000000 us
49-
status["setSimpleTrigger"] = ps.ps6000aSetSimpleTrigger(chandle, 1, source, 100, direction, 0, 1000000)
56+
status["setSimpleTrigger"] = ps.ps6000aSetSimpleTrigger(chandle, 1, source, (mV2adc(100,channelRange,maxADC), direction, 0, 1000000)
5057
assert_pico_ok(status["setSimpleTrigger"])
5158

5259
# Get fastest available timebase
@@ -166,12 +173,7 @@
166173
status["getValues"] = ps.ps6000aGetValuesBulk(chandle, 0, ctypes.byref(noOfSamples),0, 9, 1, downSampleMode, ctypes.byref(overflow))
167174
assert_pico_ok(status["getValues"])
168175

169-
# get max ADC value
170-
# handle = chandle
171-
minADC = ctypes.c_int16()
172-
maxADC = ctypes.c_int16()
173-
status["getAdcLimits"] = ps.ps6000aGetAdcLimits(chandle, resolution, ctypes.byref(minADC), ctypes.byref(maxADC))
174-
assert_pico_ok(status["getAdcLimits"])
176+
175177

176178
# convert ADC counts data to mV
177179
adc2mVChAMax = adc2mV(bufferAMax, channelRange, maxADC)

ps6000aExamples/ps6000aStreamingModeExample.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@
4949
noOfPostTriggerSamples = 900000
5050
nSamples = noOfPostTriggerSamples + noOfPreTriggerSamples
5151

52+
# get max ADC value
53+
# handle = chandle
54+
minADC = ctypes.c_int16()
55+
maxADC = ctypes.c_int16()
56+
status["getAdcLimits"] = ps.ps6000aGetAdcLimits(chandle, resolution, ctypes.byref(minADC), ctypes.byref(maxADC))
57+
assert_pico_ok(status["getAdcLimits"])
58+
5259
# Set simple trigger on channel A, 1 V rising with 1 s autotrigger
5360
# handle = chandle
5461
# enable = 1
@@ -57,7 +64,7 @@
5764
direction = enums.PICO_THRESHOLD_DIRECTION["PICO_RISING"]
5865
# delay = 0 s
5966
# autoTriggerMicroSeconds = 1000000 us
60-
status["setSimpleTrigger"] = ps.ps6000aSetSimpleTrigger(chandle, 1, source, 100, direction, 0, 1000000)
67+
status["setSimpleTrigger"] = ps.ps6000aSetSimpleTrigger(chandle, 1, source, (mV2adc(100,channelRange,maxADC), direction, 0, 1000000)
6168
assert_pico_ok(status["setSimpleTrigger"])
6269

6370
# create buffers
@@ -144,12 +151,6 @@
144151
print(noOfStreamedSamples.value)
145152

146153

147-
# get max ADC value
148-
# handle = chandle
149-
minADC = ctypes.c_int16()
150-
maxADC = ctypes.c_int16()
151-
status["getAdcLimits"] = ps.ps6000aGetAdcLimits(chandle, resolution, ctypes.byref(minADC), ctypes.byref(maxADC))
152-
assert_pico_ok(status["getAdcLimits"])
153154

154155
# plot ADC data
155156
plt.plot(bufferA[0])

0 commit comments

Comments
 (0)