diff --git a/OOequipment/Channel.m b/OOequipment/Channel.m index efd064f..0d7faf7 100644 --- a/OOequipment/Channel.m +++ b/OOequipment/Channel.m @@ -23,51 +23,51 @@ classdef Channel end function s = get.state(ch) - s = ch.scope.query(ch.CHAN('state?')); + s = ch.CHAN('state?'); end function out = get.coupling(ch) - out = ch.scope.query(ch.CHAN('coup?')); + out = ch.CHAN('coup?'); end function out = get.bandwidth(ch) - out = ch.scope.query(ch.CHAN('band?')); + out = ch.CHAN('band?'); end function out = get.offset(ch) - out = ch.scope.query(ch.CHAN('offs?')); + out = ch.CHAN('offs?'); end function out = get.scale(ch) - out = ch.scope.query(ch.CHAN('scal?')); + out = ch.CHAN('scal?'); end function out = get.label(ch) - out = ch.scope.query(ch.CHAN('lab?')); + out = ch.CHAN('lab?'); end function ch = set.state(ch,in) - ch.scope.write(ch.CHANsend('state',in)); + ch.CHAN('state',in); end function ch = set.coupling(ch,in) - ch.scope.write(ch.CHANsend('coup',in)); + ch.CHAN('coup',in); end function ch = set.bandwidth(ch,in) - ch.scope.write(ch.CHANsend('band',in)); + ch.CHAN('band',in); end function ch = set.offset(ch,in) - ch.scope.write(ch.CHANsend('offs',in)); + ch.CHAN('offs',in); end function ch = set.scale(ch,in) - ch.scope.write(ch.CHANsend('scal',in)); + ch.CHAN('scal',in); end function ch = set.label(ch,in) - ch.scope.write(ch.CHANsend('lab',in)); + ch.CHAN('lab',in); end function out = frequency(ch) @@ -98,19 +98,44 @@ classdef Channel out = str2double(ch.MEAS('phas')); end + function data = waveform(ch) + ch.scope.clear; + ch.CHAN('TYPE HRES'); + ch.scope.write('FORM REAL'); + ch.scope.write('FORM:BORD MSBF'); + ch.CHAN('DATA:POIN DEF'); + ch.scope.write('SING'); + header = str2num(ch.CHAN('DATA:HEAD?')); + ch.scope.opc; + ch.scope.write_unsafe('CHAN1:DATA?'); + prefixstring = fscanf(ch.scope.tcp,'%c',2); + prefixlength = str2double(prefixstring(2)); + datalength = fscanf(ch.scope.tcp,'%c',prefixlength); + data = fread(ch.scope.tcp,header(3),'float'); + flushinput(ch.scope.tcp); + end + end methods (Hidden, Access = private) function c = CHAN(ch,string) - c = ['CHAN',num2str(ch.channelnumber),':',string]; + if nargin == 2 + if strcmp(string(end),'?') + c = ch.scope.query(['CHAN',num2str(ch.channelnumber),':',string]); + else + c = ch.scope.write(['CHAN',num2str(ch.channelnumber),':',string]); + end + else + c = ['CHAN',num2str(ch.channelnumber),':',string,' ',in]; + end end function c = MEAS(ch,string) c = ch.scope.query(['MEAS',num2str(ch.channelnumber),':RES:ACT?',string]); end - function c = CHANsend(ch,string,in) - c = ['CHAN',num2str(ch.channelnumber),':',string,' ',in]; - end +% function c = CHANsend(ch,string,in) +% c = ['CHAN',num2str(ch.channelnumber),':',string,' ',in]; +% end end end \ No newline at end of file diff --git a/OOequipment/Equipment.m b/OOequipment/Equipment.m index 5c8ba35..f87a588 100644 --- a/OOequipment/Equipment.m +++ b/OOequipment/Equipment.m @@ -135,7 +135,7 @@ classdef Equipment < handle end end end - methods (Access = protected) + methods% (Access = protected) function write_unsafe(ecq,message) %WRITE_UNSAFE Sends command to device.