연락처

텍트로닉스 담당자와 실시간 상담 6:00am-4:30pm PST에 이용 가능

전화

전화 문의

9:00am-6:00PM KST에 이용 가능

다운로드

매뉴얼, 데이터 시트, 소프트웨어 등을 다운로드할 수 있습니다.

다운로드 유형
모델 또는 키워드

피드백

How do I use TVC ActiveX control in Matlab?

질문:

How do I use TVC ActiveX control in Matlab?

답변:

Here is a simple example using the TVC activex control:


function get_waveform_tvc;
if (exist('instrHandle'))
delete(instrHandle)
end
clear all
instrHandle = actxserver('TVC.TvcCtrl.1');
instrHandle.Descriptor = 'GPIB0::1::INSTR';
out = instrHandle.Query('* IDN ?');
recordLength = instrHandle.Query('HORIZONTAL:RECORDLENGTH?');
instrHandle.WriteString(' DATA :START 1');
instrHandle.WriteString([' DATA :STOP ' num2str(recordLength)]);
instrHandle.WriteString(' DATA :WIDTH 1');
instrHandle.WriteString(' DATA : ENC RPB');
instrHandle.WriteString('Curve?')
str = instrHandle.ReadPartialString(2);
%% section of code to make sure that the response is valid. If
%% acquisition takes long time the response may not be empty
k = 0;
while isempty(str)
   str = instrHandle.ReadPartialString(2);
   k = k + 1;
       %break
    end
endif isempty(str)
   error(['Empty curve header for CURVE query response: ',str])
end   
if ~strcmp(str(1),'#')
   error(['Incorrect curve header (not #) for CURVE query response: ',str])
end
%pause(0.1)
recordLength = str2num(instrHandle.ReadPartialString(str2num(str(2))));
out = recordLength;
           % These appeared to be most reliable and common settings, may need to change
DATA _TYPE = 17;
BYTE_ORDER = 1;
readLength = recordLength; % could be something smaller
switch DATA _TYPE
case 17
   % this is the only more or less reliable setting
   % that handles large recordlengths
   out = (instrHandle.ReadIEEEBlock( DATA _TYPE,BYTE_ORDER,readLength))';
   out = double(int16(out)); % I am not sure that this is necessary, check the data types. Depends on MATLAB version
case {18,2,4,5}
   out = (instrHandle.ReadIEEEBlock( DATA _TYPE,BYTE_ORDER,readLength))';
case 2
   out = (instrHandle.ReadIEEEBlock( DATA _TYPE,BYTE_ORDER,readLength))';
otherwise
   error('Incorrect Data type')
end
ymult = str2num(instrHandle.Query('WFMP:YMULT?'));
yoff = str2num(instrHandle.Query('WFMP:YOFF?'));
xmult = str2num(instrHandle.Query('WFMP:XINCR?'));
xoff = str2num(instrHandle.Query('WFMP:PT_OFF?'));
xzero = str2num(instrHandle.Query('WFMP:XZERO?'));
ydata = ymult*(out - yoff);
xdata = xmult*((0:length(ydata)-1)-xoff)+xzero;
plot(xdata, ydata)
%After all data is read, use this, some instruments may not require this, it should return emty string then.
%out = instrHandle.ReadPartialString(2); % read the semicolon and newline character


이 FAQ는 다음에 적용 됩니다:

제품 시리즈 없음

제품:

FAQ ID 52726

모든 FAQ 보기 »