AnsweredAssumed Answered

How to Remove Error -401 (Command asserted before Op comp.)

Question asked by zubairrafiq on Jan 13, 2010
Latest reply on Jan 13, 2010 by tsilchia
HI all
i am working with PNA everything is fine except error message displayed on PNA Screen
'Error -401 Command asserted before operation is completed'
Please tell me how to remove this error.
my Matlab code is written below
Thanx.
%//////////////////////////////////////////////////////////////////////

handle_PNA = gpib('ni',0,16);
N=401;
set(handle_PNA,'InputBufferSize',1024*8);
fopen(handle_PNA);
% fwrite(handle_PNA,'FORM:DATA?');
% r_val =sprintf('%c',fread(handle_PNA,8,'uchar'));

fwrite(handle_PNA,'SYSTem:PRESet;*wai');
fwrite(handle_PNA,'INITiate:CONTinuous OFF');
%fprintf(handle_PNA,'SENS:SWE:GEN STEP');
   fwrite(handle_PNA,'SENSe:SWE:MODE HOLD');
fprintf(handle_PNA,'DISP:WIND1:STATE OFF');
fprintf(handle_PNA,'DISP:WIND2:STATE ON');

fprintf(handle_PNA,'CALC:PAR:DEF "MyMeas",A');
fprintf(handle_PNA,'CALC1:PAR:SEL "MyMeas"');
fprintf(handle_PNA,'DISP:WIND2:TRAC:FEED "MyMeas"');

fprintf(handle_PNA,'SENS:FREQ:STAR %d', 10e9);
fprintf(handle_PNA,'SENS:FREQ:STOP %d', 12e9);

  fprintf(handle_PNA,'SENS:SWE:POIN %d', N);
fprintf(handle_PNA,'SENS:BWID %d', 100);
  fprintf(handle_PNA,'SOUR:POW1 %d ', -10);
fprintf(handle_PNA,'sens:swe:gen step');
fprintf(handle_PNA,'INIT:IMM;*OPC');
fprintf(handle_PNA,'*OPC?');
%---------------------------------------------------------------------------------------------
fwrite(handle_PNA,'FORM REAL,32'); % i found error at this point Possibaly
%-----------------------------------------------------------------------------------
fwrite(handle_PNA,'FORM:BORD SWAP');

fwrite(handle_PNA,'CALCulate:DATA? SDATA');
y=fread(handle_PNA,N*2+2,'float32');
fwrite(handle_PNA,'FORM ASCii'); % wriing back default data format
y1 = y(3:2:2*N+2)+j*y(4:2:2*N+2);
plot(ab(y1),'g')
ylim([-50 50]);
grid on
%////////////////////////////////////////////////////////////////////////



Regards,
Muhammad Zubair Rafiq  

Outcomes