Setting up the Arbitrary waveform generator in python

Post general discussions on using our drivers to write your own software here
Post Reply
AlfonsoMC
Newbie
Posts: 0
Joined: Tue Jul 18, 2023 10:29 am

Setting up the Arbitrary waveform generator in python

Post by AlfonsoMC »

Hi,
I'm using a PicoScope 5442D with picoSDK and python, and I've been trying to use the AWG but haven't managed to make it work so far, as it only generates noise.
In the code below, I try to generate a sinusoidal signal starting off the examples provided. To check the generated signal, I've reused the code from the example "ps5000BlockExample"

Code: Select all

# create a custom waveform
awgBuffer = np.sin(np.linspace(0,2*math.pi,1024))
awgbufferPointer = awgBuffer.ctypes.data_as(ctypes.POINTER(ctypes.c_int16))

# 10KHz 
deltaPhase = ctypes.c_int32(0)
ps.ps5000aSigGenFrequencyToPhase(chandle,10000,0,1024,ctypes.byref(deltaPhase))

status["setSigGenArbitrary"] = ps.ps5000aSetSigGenArbitrary(chandle, 0, 2000000, deltaPhase.value, deltaPhase.value, 0, 0, awgbufferPointer, 1024, 0, 0, 0, 0, 0, 0, 0, 0)
assert_pico_ok(status["setSigGenArbitrary"])
If I try to use the Built-In signal generator as in the following example, the signal is generated correctly.

Code: Select all

wavetype = ctypes.c_int32(0)
sweepType = ctypes.c_int32(0)
triggertype = ctypes.c_int32(0)
triggerSource = ctypes.c_int32(0)

status["setSigGenBuiltInV2"] = ps.ps5000aSetSigGenBuiltInV2(chandle, 0, 2000000, wavetype, 10000, 10000, 0, 1, sweepType, 0, 0, 0, triggertype, triggerSource, 0)
assert_pico_ok(status["setSigGenBuiltInV2"])
I've been searching for a while but still not found a way to make it work, so any help would be appreciated.
Attachments
Using the Built-In generator
Using the Built-In generator
Using the AWG
Using the AWG

Post Reply