Tel: 886.2.2175 2930 Email: [email protected]
www.salukitec.com
268
status = viWrite(analyzer, ":CALCulate:PARameter:SELect ' CH1_WIN1_LINE1'\n", 25,&retCnt);
// obtain the number of sweep point
status = viWrite(analyzer, ":SENSe1:SWEep:POIN?\n", 15, &retCnt);
status = viRead(analyzer, rd_Buf_Data, 30, &retCnt);
points = atoi(rd_Buf_Data);
// sweep once
status = viWrite(analyzer, ":SENSe1:SWEep:GROups:COUNt 1\n",30, &retCnt);
status = viWrite(analyzer, ":SENS:SWE:MODE GROups\n",30, &retCnt);
// sending and reading of data command. Here the data format is original data, divided into the real part and imaginary part. The
returned character//string format is: "real part of the first point, imaginary part of the first point, real part of the second point, imaginary
part of the second point..."
status = viWrite(analyzer, ": CALCulate:DATA? SDATA\n",30, &retCnt);
status = viRead(analyzer, rd_Buf_BigData, VI_READ_BUFLEN, &retCnt);
}
9.3.7.
Command Synchronization
The method of command synchronization is introduced below, taking the sweep process as an example.
void SweepSync()
{
ViStatus status;
long retCnt;
ViEventType etype;
ViEvent eevent;
int stat;
char OpcOk [2];
/*********************************************************************/
/* Command INITiate[:IMMediate] start single sweep ( closed in continuous scanningINIT:CONT OFF)*/
* Execute next command of command buffer zone after single sweep */
*********************************************************************/
status = viWrite(analyzer, "INIT:CONT OFF", 13, &retCnt);
// Method 1 of waiting for ending of sweep: use *WAI
status = viWrite(analyzer, "ABOR;INIT:IMM;*WAI", 18, &retCnt);
// Method 2 of waiting for ending of sweep: use *OPC
?