Skip to content

Commit 3f79204

Browse files
author
neil.hamilton
committed
Add arbitrary waveform functions to ps2000aSigGen.py
1 parent 97c73f0 commit 3f79204

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

ps2000aExamples/ps2000aSigGen.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
from picosdk.ps2000a import ps2000a as ps
1313
import time
1414
from picosdk.functions import assert_pico_ok
15+
import numpy as np
16+
import math
17+
18+
1519

1620

1721
# Gives the device a handle
@@ -121,6 +125,34 @@
121125
# Pauses the script to show signal
122126
time.sleep(36)
123127

128+
# create a custom waveform
129+
awgBuffer = np.sin(np.linspace(0,2*math.pi,1024))
130+
awgbufferPointer = awgBuffer.ctypes.data_as(ctypes.POINTER(ctypes.c_int16))
131+
132+
# output custom waveform with peak-to-peak of 2 V and frequency of 10 kHz
133+
# handle = chandle
134+
# offsetVoltage = 0
135+
# pkToPk = 2000000
136+
# startDeltaPhase = 0
137+
# stopDeltaPhase = 0
138+
# deltaPhaseIncrement = 0
139+
# dwellCount = 0
140+
# *arbitaryWaveform = awgbufferPointer
141+
# arbitaryWaveformSize = 1024
142+
# sweepType = ctypes.c_int32(1) = PS5000A_UP
143+
# operation = 0
144+
# shots = 0
145+
# sweeps = 0
146+
# triggerType = ctypes.c_int16(0) = PS5000A_SIGGEN_RISING
147+
# triggerSource = ctypes.c_int16(0) = PS5000A_SIGGEN_NONE
148+
# extInThreshold = 0
149+
150+
status["setSigGenArbitrary"] = ps.ps2000aSetSigGenArbitrary(chandle, 0, 2000000, 0, 0, 0, 0, awgbufferPointer, 1024, 0, 0, 0, 0, 0, 0, 0, 0)
151+
assert_pico_ok(status["setSigGenArbitrary"])
152+
153+
# Pauses the script to show signal
154+
time.sleep(36)
155+
124156
# Closes the unit
125157
# Handle = chandle
126158
status["close"] = ps.ps2000aCloseUnit(chandle)

0 commit comments

Comments
 (0)