소스 검색

waveform functie verplaatst naar channel-class. Channel ook gelijk opgeruimt

publish
Wouter Horlings 8 년 전
부모
커밋
e5d4a9e98e
2개의 변경된 파일42개의 추가작업 그리고 17개의 파일을 삭제
  1. +41
    -16
      OOequipment/Channel.m
  2. +1
    -1
      OOequipment/Equipment.m

+ 41
- 16
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

+ 1
- 1
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.


불러오는 중...
취소
저장