
Programming Examples
// Scan FORMat PACKed header.
if (*pBuf++ != '#') {
printf("Failed to scan packed header start\n");
WriteDev("abort");
Quit();
}
Digits = *pBuf++ - '0';
if (Digits < 1 || Digits > 9) {
printf("Failed to scan packed header size\n");
WriteDev("abort");
Quit();
}
int Size = 0;
for (i=0; i<Digits; i++) {
Size = 10 * Size + (int)(*pBuf++ - '0');
}
// With format packed and format:tinf on each sample is
// a double format measurement value and a 64 bit
// integer timestamp (in ps), for a total of
// 16 bytes / sample.
Samples = Size / 16;
for (i=0; i<Samples; i++) {
Val = *((double*)pBuf);
pBuf += 8;
if (i == 0 && _isnan(Val)) {
// Invalid value response.
printf("The instrument is apparently no longer measuring.\n");
Failed = true;
break;
}
TSVal = *((__int64*)pBuf);
pBuf += 8;
// Do something with the fetched result. For this
// test just check that the measurement result seems
// reasonable and that the timestamps increase as
// they should.
if (CheckMeas(Val, Args)) {
printf("Bad result of measurement %lf: %g %s\n", (double)Count, Val,
(Args.bPeriod ? "s" : "Hz"));
// Check that the timestamps keep increasing during
// the test run.
if (TSVal <= PrevTSVal) {
printf("Invalid timestamp, sample %lf, prev = %lf, Cur = %lf\n",
(double)Count, (double)PrevTSVal * 1e-12,
(double)TSVal * 1e-12);
}
// Check for gaps in the measurement data. This will
FCA3000, FCA3100, MCA3000 Series Programmer Manual
4-19
Содержание 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 ...