|
- classdef TriggerClass
- %TRIGGER Summary of this class goes here
- % Detailed explanation goes here
-
- properties (Hidden, Access = private)
- scope
- end
-
- properties (Dependent)
- mode
- type
- source
- slope
- level
- coupling
- hfreject
- end
-
- methods
- function tr = TriggerClass(scope)
- tr.scope = scope;
- end
-
- function s = get.mode(tr)
- s = tr.gettrig('mode?');
- end
-
- function s = get.type(tr)
- s = tr.gettrig('type?');
- end
-
- function s = get.source(tr)
- s = tr.gettrig('sour?');
- end
-
- function s = get.level(tr)
- s = tr.gettrig(['LEV',tr.trigsource,'?']);
- end
-
- function s = get.coupling(tr)
- s = tr.gettrig('EDGE:COUP?');
- end
-
- function s = get.hfreject(tr)
- s = tr.gettrig('EDGE:FILT:HFR?');
- end
-
- function tr = set.mode(tr,string)
- tr.settrig(['mode ',string]);
- end
-
- function tr = set.type(tr,string)
- tr.settrig(['type ',string]);
- end
-
- function tr = set.source(tr,string)
- tr.settrig(['sour ',string]);
- end
-
- function tr = set.level(tr,level)
- tr.settrig(['LEV',tr.trigsource,' ',num2str(level)]);
- end
-
- function tr = set.coupling(tr,string)
- tr.settrig(['EDGE:COUP ',string]);
- end
-
- function tr = set.hfreject(tr,string)
- tr.settrig(['EDGE:FILT:HFR ' string]);
- end
-
-
- end
-
- methods (Hidden, Access = private)
- function c = gettrig(tr,string)
- c = tr.scope.query(['TRIG:A:',string]);
- end
-
- function settrig(tr,string)
- tr.scope.write(['TRIG:A:',string]);
- 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 src = trigsource(tr)
- src = tr.source;
- channel = regexp(src,'(?<=CH)[1-4]','match','once');
- if ~isempty(channel)
- src = channel;
- elseif strcmp(src,'EXT')
- src = '5';
- else
- error('Cannot get a trigger level for these settings. Try to switch the trigger source to a channel or external');
- end
- end
- end
-
- end
|