6
VISA Programming Examples
250
ViInt32
noOfValues;
logged*/
ViReal64
averagingTime;
logging cycle */
ViPChar
replySubStr;
the instruments reply */
ViInt32
noOfDigits;
the amount data
to be read */
ViUInt32
retCnt;
bytes read calling viRead */
errStatus = InitVisa(&vi);
if(errStatus < VI_SUCCESS)
{
exit(errStatus);
}
/* clear instrument error queue */
errStatus = viPrintf(vi,"*CLS\n");
checkError(vi,errStatus);
/* turn auto range on */
errStatus = viPrintf(vi,"SENS1:CHAN1:POW:RANGE:AUTO 1\
n");
checkError(vi,errStatus);
/* send the command sequence for continuous logging */
slot = 1;
chan = 1;
noOfValues = 100;
averagingTime = 0.02; /* set averaging time to 20ms */
viPrintf(vi,"SENS%1d:CHAN%1d:FUNC:PAR:LOGG %d,%f\n",
slot,
chan,
noOfValues,
averagingTime);
checkError(vi,errStatus);
/* start logging */
viPrintf(vi,"SENS%1d:CHAN%1d:FUNC:STAT LOGG,START\
n",slot,chan);
checkError(vi,errStatus);
/* to display the results, logging should be completed */
/* the instrument has to be polled about the progress of
the logging */
do
8163A/B, 8164A/B & 8166A/B Mainframes Programming Guide
/* number of values to be
/* aveaging time used in a
/* pointer to a substring of
/*number of digits, specifing
/* returns the number of
/* log 100 values */