forked from tektronix/Programmatic-Control-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrsa_mask_test.m
71 lines (59 loc) · 2.2 KB
/
rsa_mask_test.m
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
% VISA Control: RSA Mask Test
% Author: Morgan Allison
% Date Edited: 8/17
% This program sets up a default mask test and queries the frequencies
% at which violations occured.
% Windows 7 64-bit, TekVISA 4.0.4
% Matlab r2017a with ICT
% Download SignalVu-PC programmer manual: http://www.tek.com/node/1828803
% Download RSA5100B programmer manual:
% http://www.tek.com/spectrum-analyzer/inst5000-manual-7
% Tested on RSA306B/RSA507A with SignalVu-PC 3.10.0030
%% #################SEARCH/CONNECT#################
visaBrand = 'tek';
% instAddress = 'TCPIP::192.168.1.10::INSTR';
instAddress = 'GPIB8::1::INSTR';
buf = 50000;
inst = visa(visaBrand, instAddress);
set(inst, 'InputBuffer', buf);
set(inst, 'OutputBuffer', buf);
fopen(inst);
inst.timeout = 15;
instID = query(inst,'*idn?');
fprintf('Connected to %s\n',instID);
% preset, clear buffer, and stop acquisition
fprintf(inst, 'system:preset');
fprintf(inst, '*cls');
fprintf(inst, 'abort');
%% #################INITIALIZE VARIABLES#################
cf = 2.4453e9;
span = 40e6;
fprintf(inst, 'system:preset');
fprintf(inst, 'display:general:measview:new dpx');
fprintf(inst, 'spectrum:frequency:center %d', cf);
fprintf(inst, 'spectrum:frequency:span %d', span);
fprintf(inst, 'calculate:search:limit:match:beep on');
fprintf(inst, 'calculate:search:limit:match:sacquire off');
fprintf(inst, 'calculate:search:limit:match:sdata off');
fprintf(inst, 'calculate:search:limit:match:spicture off');
fprintf(inst, 'calculate:search:limit:match:strace off');
fprintf(inst, 'calculate:search:limit:operation omask');
fprintf(inst, 'calculate:search:limit:operation:feed "dpx", "Trace1"');
fprintf(inst, 'calculate:search:limit:state on');
%% #################ACQUIRE/PROCESS DATA#################
fprintf(inst, 'initiate:immediate');
query(inst, '*opc?');
if str2num(query(inst, 'calculate:search:limit:fail?')) == 1
maskPoints = str2num(query(inst, 'calculate:search:limit:report:data?'));
disp(maskPoints);
fprintf('Mask Violations: %s\n', maskPoints(1));
for i = 2:length(maskPoints)
fprintf('Violation Range: %s\n', maskPoints(i));
end
else
fprintf('No mask violations have occurred.\n');
end
%% Close inst
fclose(inst);
delete(inst);
clear inst;