AnsweredAssumed Answered

Reading s parameters via GPIB

Question asked by ave_777 on Mar 31, 2009
Latest reply on Mar 31, 2009 by odanzy
I'm wraiting a c program to read s parameters from e8363c but always failed. Is there some suggestion for me ,thanks!
Here is my program:
float data[201]={1};

  ViSession defaultRM, vi;
  viOpenDefaultRM (&defaultRM);
  viOpen (defaultRM, "GPIB0::16::INSTR", VI_NULL,VI_NULL, &vi);

  viSetAttribute(vi,VI_ATTR_TMO_VALUE,10000);
  viPrintf (vi, "SYSTem:PRESet;*wai\n");
  viPrintf (vi, "CALCulate:PARameter:SELect 'CH1_S11_1'\n");
  viPrintf (vi, "CALCulate:FORM MLOG\n");

  viPrintf (vi, "SENS1:FREQ:START 4GHz\n");
  viPrintf (vi, "SENS1:FREQ:STOP  5GHz\n");
  viPrintf (vi, "SENS1:SWE:POIN 201\n");
  viPrintf (vi, "SOUR1:POW:LEV 0dbm\n");
  viPrintf (vi, "SENS1:BWID 1KHz\n");
  viPrintf (vi, "SENS1:SWE:TIME 1\n");

  viPrintf (vi, "FORM:DATA Real,64\n");
  viPrintf (vi, "FORM:BORD SWAP\n");

  viPrintf (vi, "INITiate:CONTinuous OFF\n");
  viPrintf (vi, "INITiate:IMMediate;*wai\n");

  viPrintf (vi, "CALCulate:DATA? FDATA;*wai\n");

  viScanf(vi,"%le",data);   //always  "Query interrupted"
  for(int k=0;k<201;k++)
  { printf("The data[%d] is:%f\n",k,data[k]);}

  viPrintf (vi, "INITiate:CONT on\n");
  viPrintf (vi, "CALCulate:MARK1:STAT ON\n");

  /* Close session */
  viClose (vi);
  viClose (defaultRM);  

Outcomes