-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSmartScopeAnalogOutput.m
More file actions
32 lines (26 loc) · 1.05 KB
/
SmartScopeAnalogOutput.m
File metadata and controls
32 lines (26 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SmartScopeAnalogOutput - Uploads a custom analog waveform to the
% SmartScope and activates the analog output
%
% Prerequisites:
% - make sure SmartScopeConnect was executed succesfully first
%
% Usage:
% - just run this script
% - adjust the customWave contents and GeneratorSamplePeriod to your liking
% defines the content of the analog wave (directly in Voltages), making sure all values are withing the
% [0V, 3.3V] boundaries
% this code creates a simple multisine of 1000 points
customWave = sin(2*pi/1000*(1:1000)) + sin(4*pi/1000*(1:1000));
customWave = (customWave+2)/4*3.3;
%to be safe: first disable all outputs
scope.GeneratorToDigitalEnabled = 0;
scope.GeneratorToAnalogEnabled = 0;
%upload custom wave
scope.GeneratorDataDouble = customWave;
%set output frequency (in seconds)
scope.GeneratorSamplePeriod = 0.0000001;
%CommitSettings must be called to make the samplePeriod setting effective
scope.CommitSettings
%enable analog output
scope.GeneratorToAnalogEnabled = 1;