-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset_role.m
More file actions
30 lines (26 loc) · 792 Bytes
/
set_role.m
File metadata and controls
30 lines (26 loc) · 792 Bytes
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
%% set_role.m
% This function allows configure one UUT to slave off another.
%
%%
function set_role(uut,role,sample_rate)
% Lower case "uut" so as not to clash with the GLOBAL variable.
disp(uut)
% Configure port and open
ID = tcpip(uut,4220); % 4220 = System Controller
ID.terminator = 10; % ASCII line feed
ID.InputBufferSize = 100;
ID.Timeout = 5;
fopen(ID);
if strcmpi(role,'master')
% Set Master
command = sprintf('set.sync_role MASTER %d', sample_rate);
elseif strcmpi(role,'slave')
% Set Slave
command = sprintf('set.sync_role SLAVE %d', sample_rate);
else
disp('Invalid role entered! Please use either "master" or "slave"')
end
fprintf(ID,command);
fclose(ID);
delete(ID);
end