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