-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathold650setsyncfreq.m
More file actions
42 lines (31 loc) · 806 Bytes
/
Copy pathold650setsyncfreq.m
File metadata and controls
42 lines (31 loc) · 806 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
31
32
33
34
35
36
37
38
39
40
41
function old650setsyncfreq(freq)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
global g_650;
% Check for initialization
if isempty(g_650) || ~isvalid(g_650)
error('Meter has not been initialized.');
end
% Set freq. If nonzero, setting freq to sync with. If zero, tells meter to
% not use sync.
if (freq ~= 0)
cmd = ['s01,,,,' num2str(freq) ',0,01,1'];
else
cmd = ['s01,,,,' ',0,01,1'];
end
% flush buffers
flush(g_650);
% Write command
writeline(g_650, cmd);
% response
response = old650getresult(10, 1);
if length(response) == 0
error('No response after set sync command');
end
fprintf('response: %s\n', response);
qual = sscanf(response, '%f', 1);
if qual ~= 0
fprintf('Return string was %s\n', response);
error('Can''t set sync freq');
end
end