Skip to content

Commit 3ecb487

Browse files
author
neil.hamilton
committed
Add arbitrary waveform generation to example
1 parent e541016 commit 3ecb487

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

examples/PS6000A_ID_Signal_Generator_Example.m

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,38 @@
149149

150150
pause(5)
151151

152+
153+
%% get max value for arbitrary buffer
154+
155+
maxValue = 0;
156+
minValue = 0;
157+
maxValuePtr = libpointer('doublePtr',maxValue);
158+
minValuePtr = libpointer('doublePtr',minValue);
159+
step = 0;
160+
stepPtr = libpointer('doublePtr',step);
161+
status.sigGenLimits = invoke(ps6000aDeviceObj, 'ps6000aSigGenLimits',ps6000aEnumInfo.enPicoSigGenParameter.PICO_SIGGEN_PARAM_SAMPLE,minValuePtr,maxValuePtr,stepPtr);
162+
163+
maxValue = maxValuePtr.Value;
164+
165+
%% create an arbitary waveform
166+
167+
awgBufferSize = 40000;
168+
x = 0:(2*pi)/(awgBufferSize - 1):2*pi;
169+
y = (normalise(sin(x) + sin(2*x)))*maxValue;
170+
171+
yPtr = libpointer('int16Ptr',y);
172+
173+
%% set signal generator output arbitary waveform
174+
175+
waveType = ps6000aEnumInfo.enPicoWaveType.PICO_ARBITRARY;
176+
177+
[status.sigGenWaveform] = invoke(ps6000aDeviceObj,'ps6000aSigGenWaveform',waveType, yPtr,awgBufferSize);
178+
179+
% apply changes
180+
sweepEnabled = 0;
181+
[status.sigGenApply] = invoke(ps6000aDeviceObj, 'ps6000aSigGenApply', sigGenEnabled, sweepEnabled, triggerEnabled, automaticClockOptimisationEnabled, overrideAutomaticClockAndPrescale, pFrequency, pStopFrequency, pFrequencyIncrement, pDwellTime);
182+
183+
pause (5)
152184
%% Disconnect scope
153185

154186
disconnect(ps6000aDeviceObj);

0 commit comments

Comments
 (0)