
Programming Examples
// Set the timeout for message-based communication (10 s)
if (viSetAttribute(Instr, VI_ATTR_TMO_VALUE, 10000) != VI_SUCCESS) {
QuitMsg("Failed to set timeout\n");
}
// Set up for "in
fi
nite" number of measurements
printf("\n");
sprintf(Command, "trig:coun 1;:arm:coun inf");
if (WriteDev(Command) != VI_SUCCESS) Quit();
// set pacing. note: for freq:btb meas time is actual pacing
if ( Args.bPeriod ) {
sprintf(Command, "trig:sour tim;:trig:tim %lg", Args.Pacing);
}
else {
sprintf(Command, "sens:acq:aper %lg", Args.Pacing);
}
if (WriteDev(Command) != VI_SUCCESS) Quit();
// FORMat PACKed is the recommended format for maximum fetch
// speed and for best timestamp resolution.
sprintf(Command, "form pack;:form:tinf on;:disp:enab off");
if (WriteDev(Command) != VI_SUCCESS) Quit();
PrevTSVal = 0;
Failed = false;
Sleep(500);
// Start the measurement.
if (WriteDev("init") != VI_SUCCESS) Quit();
// Fetch the measurement results as it goes.
Count = 0;
while (true) {
CheckUserCancel();
// The 'max' parameter means fetch as many samples as is
// currently available for fetching (but no more than
// the upper limit, which by default is 10000).
if (WriteDev("fetc:arr? max") != VI_SUCCESS) Quit();
if (ReadDev(Buffer, BUFSIZE, &ReadLength) != VI_SUCCESS) Quit();
Buffer[ReadLength] = 0; // Null terminate.
pBuf = Buffer;
// Check for fetc:arr? max 'no data' marker.
char *p = pBuf;
if (*p++ == '#' && *p++ == '1' && *p == '0') {
// There is no data available at the moment. Wait a
// bit with the next fetch attempt in order to avoid
// swamping the instrument with useless operations
// which could actually starve the measurement
// handling in the instrument.
Sleep(20);
continue;
}
4-18
FCA3000, FCA3100, MCA3000 Series Programmer Manual
Содержание FCA3000 Series
Страница 2: ......
Страница 8: ...Preface iv FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Страница 9: ...Getting Started ...
Страница 10: ......
Страница 14: ...Using the USB Interface 1 4 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Страница 15: ...Syntax and Commands ...
Страница 16: ......
Страница 26: ...Command Syntax 2 10 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Страница 135: ...Status and Events ...
Страница 136: ......
Страница 156: ...Status and Events 3 20 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Страница 157: ...Programming Examples ...
Страница 158: ......
Страница 179: ...Appendices ...
Страница 180: ......
Страница 181: ...Appendix A Character Set FCA3000 FCA3100 MCA3000 Series Programmer Manual A 1 ...
Страница 182: ...Appendix A Character Set A 2 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Страница 188: ...Appendix D Reserved Words D 2 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...