|
|
|
@@ -11,6 +11,9 @@ classdef Equipment < handle |
|
|
|
properties (Dependent, SetAccess=private) |
|
|
|
error |
|
|
|
end |
|
|
|
properties (Hidden) |
|
|
|
debugbool |
|
|
|
end |
|
|
|
|
|
|
|
methods |
|
|
|
function ecq = Equipment(ipAddress,port,channel) |
|
|
|
@@ -23,6 +26,7 @@ classdef Equipment < handle |
|
|
|
ecq.locked = false; |
|
|
|
ecq.channel = channel; |
|
|
|
ecq.name = ecq.idn(); |
|
|
|
ecq.debugbool = false; |
|
|
|
if channel >= 0 |
|
|
|
ecq.setPrologix; |
|
|
|
end |
|
|
|
@@ -45,6 +49,10 @@ classdef Equipment < handle |
|
|
|
ecq.write_unsafe('*rst'); |
|
|
|
end |
|
|
|
|
|
|
|
function debug(ecq) |
|
|
|
ecq.debugbool = ~ecq.debugbool; |
|
|
|
end |
|
|
|
|
|
|
|
function flush(ecq) |
|
|
|
flushinput(ecq.tcp); |
|
|
|
flushoutput(ecq.tcp); |
|
|
|
@@ -142,7 +150,9 @@ classdef Equipment < handle |
|
|
|
ecq.write_unsafe('++read'); |
|
|
|
end |
|
|
|
output = fscanf(ecq.tcp); |
|
|
|
fprintf(['<< ',output]); |
|
|
|
if ecq.debugbool |
|
|
|
fprintf(['<< ',output]); |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
function output = query(ecq,message) |
|
|
|
@@ -196,10 +206,14 @@ classdef Equipment < handle |
|
|
|
%See also WRITE, QUERY |
|
|
|
if ecq.channel >= 0 |
|
|
|
fprintf(ecq.tcp,['++addr ', num2str(ecq.channel)]); |
|
|
|
fprintf(['>> ++addr ', num2str(ecq.channel),'\n']); |
|
|
|
if ecq.debugbool |
|
|
|
fprintf(['>> ++addr ', num2str(ecq.channel),'\n']); |
|
|
|
end |
|
|
|
end |
|
|
|
fprintf(ecq.tcp, message); |
|
|
|
fprintf(['>> ',message,'\n']); |
|
|
|
if ecq.debugbool |
|
|
|
fprintf(['>> ',message,'\n']); |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
function write_noerror(ecq,message) |
|
|
|
|