Skip to content

Commit d0231b1

Browse files
author
neil.hamilton
committed
Add binary section to ps2000aSigGen.py
1 parent 3dc9b5f commit d0231b1

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

ps2000aExamples/ps2000aSigGen.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@
133133

134134
status["freq2phase"] = ps.ps2000aSigGenFrequencyToPhase(chandle, 100, 0, 1024, ctypes.byref(phase))
135135
assert_pico_ok(status["freq2phase"])
136-
print(phase.value)
137136

138137
# output custom waveform with peak-to-peak of 2 V and frequency of 10 kHz
139138
# handle = chandle
@@ -160,6 +159,40 @@
160159
# Pauses the script to show signal
161160
time.sleep(36)
162161

162+
# output a custom binary sequence from the AWG
163+
# create a binary buffer for AWG
164+
binaryBuffer = [0,1,0,1,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,1,1,0]
165+
cBinaryBuffer = (ctypes.c_int16*len(binaryBuffer))(*binaryBuffer)
166+
binarybufferPointer = ctypes.byref(cBinaryBuffer)
167+
168+
phase2 = ctypes.c_uint32(0)
169+
170+
status["freq2phase"] = ps.ps2000aSigGenFrequencyToPhase(chandle, 10, 0, 1024, ctypes.byref(phase2))
171+
assert_pico_ok(status["freq2phase"])
172+
173+
174+
# output custom waveform with peak-to-peak of 2 V and frequency of 10 kHz
175+
# handle = chandle
176+
# offsetVoltage = 0
177+
# pkToPk = 2000000
178+
# startDeltaPhase = phase
179+
# stopDeltaPhase = 0
180+
# deltaPhaseIncrement = 0
181+
# dwellCount = 0
182+
# *arbitaryWaveform = awgbufferPointer
183+
# arbitaryWaveformSize = 1024
184+
# sweepType = ctypes.c_int32(1) = PS5000A_UP
185+
# operation = 0
186+
# indexMode = 0 = PS2000A_SINGLE
187+
# shots = 0
188+
# sweeps = 0
189+
# triggerType = ctypes.c_int16(0) = PS5000A_SIGGEN_RISING
190+
# triggerSource = ctypes.c_int16(0) = PS5000A_SIGGEN_NONE
191+
# extInThreshold = 0
192+
193+
status["setSigGenArbitrary"] = ps.ps2000aSetSigGenArbitrary(chandle, 0, 2000000, phase2, phase2, 0, 0, binarybufferPointer, len(cBinaryBuffer), 0, 0, 0, 0, 0, 0, 0, 0)
194+
assert_pico_ok(status["setSigGenArbitrary"])
195+
163196
# Closes the unit
164197
# Handle = chandle
165198
status["close"] = ps.ps2000aCloseUnit(chandle)

0 commit comments

Comments
 (0)