100 Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide
Programming Examples
GPIB Programming Interface Examples
stat = viPrintf(inst, "SWEEP:DWELL %e\n", dwell);
// setup number of points
stat = viPrintf(inst, "SWEEP:POINTS %d\n", npoints);
// set interface timeout to double the expected sweep time
// sweep takes (~15ms + dwell) per point * number of points
// the timeout should not be shorter then the sweep, set it
// longer
long timeoutMS = long(2*npoints*(.015+dwell)*1000);
// set the VISA timeout
stat = viSetAttribute(inst, VI_ATTR_TMO_VALUE, timeoutMS);
// set continuous trigger mode off
stat = viPrintf(inst, "INIT:CONT OFF\n");
// turn list sweep on
stat = viPrintf(inst, "FREQ:MODE LIST\n");
int sweepNo = 0;
while(intCounter>0 )
{
// start the sweep (initialize)
stat = viPrintf(inst, "INIT\n");
printf("Sweep %d started\n",++sweepNo);
// wait for the sweep completion with *OPC?
int res ;
stat = viPrintf(inst, "*OPC?\n");
stat = viScanf(inst, "%d", &res);
// handle possible errors here (most likely a timeout)
// err_handler( inst, stat );
puts("Sweep ended");
// delay before sending next INIT since instrument
// may not be ready to receive it yet
Sleep(15);
Содержание X-Series
Страница 4: ...4 ...
Страница 10: ...10 Contents ...