FAQs from Rohde & Schwarz

Remote Control of power head: I do not get a response on the 'FETCh?' command

Question

I remote control the power head to get data out of it.

I use the external trigger (EXT2) to trigger the measurement. All commands are correct but I get no response on the 'FETCh?' command. What is missing.

Here my script:

function NRPxxSN(~)

% Open a RAW socket connection

NRPxxSN=tcpip('nrp18sn-101765',5025);

NRPxxSN.InputBufferSize=10000;

fopen(NRPxxSN);

% Make a preset and configure the measurement

fprintf(NRPxxSN, '*RST;*CLS;*WAI');

fprintf(NRPxxSN, 'UNIT:POW DBM');

fprintf(NRPxxSN, 'SENS:FUNC "XTIME:POW"');

fprintf(NRPxxSN, 'CALC:FEED "POW:TRAC"');

fprintf(NRPxxSN, 'SENS:TRAC:POIN 500');

fprintf(NRPxxSN, 'SENS:TRAC:TIME 2e-3');

fprintf(NRPxxSN, 'SENS:TRAC:AVER OFF');

fprintf(NRPxxSN, 'SENS:FREQ 1e9');

fprintf(NRPxxSN, 'TRIG:SOUR EXT2');

fprintf(NRPxxSN, 'INIT:CONT OFF');

% Initiate the measurement

fprintf(NRPxxSN, 'INIT');

% Get the result

fprintf(NRPxxSN, 'FETC?');

a=fscanf(NRPxxSN);

% Close the connection and clean up:

fclose(NRPxxSN);

delete(NRPxxSN);

end

Answer

The 'FETCh?' gets only available results.

So after initiating the measurement you have to check if the trigger arrives and after this if the measurement has finished.

Please insert the following sequence in you script after the 'INIT' command:

% Wait for the trigger

NoTrigger=2;

while NoTrigger>1

pause(0.01);

fprintf(NRPxxSN, 'STAT:OPER:TRIG:COND?');

NoTrigger=fscanf(NRPxxSN,'%i');

%disp(NoTrigger);

end

% Wait till the measurement has finished

MeasRunning=2;

while MeasRunning>1

pause(0.01);

fprintf(NRPxxSN, 'STAT:OPER:MEAS:COND?');

MeasRunning=fscanf(NRPxxSN,'%i');

%disp(MeasRunning);

end