EasyManua.ls Logo

Pendulum CNT-90 - Page 59

Pendulum CNT-90
264 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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
// happen if we try to measure faster than we can
// keep up with fetching.
if (Count != 0 &&
fabs((double)(TSVal - PrevTSVal) * 1e-12 -
Args.Pacing) >
1.5 * Args.Pacing) {
printf("Gap: %lf -> %lf\n",
(double)PrevTSVal * 1e-12,
(double)TSVal * 1e-12);
}
PrevTSVal = TSVal;
Count++;
// Display some progress.
if (Count % 10000 == 0) {
printf("Sample %.0lf, value %.8le, timestamp
%lf\n",
(double)Count, Val, (double)TSVal *
1e-12);
}
Programming Examples
Error Code 4-23

Table of Contents

Other manuals for Pendulum CNT-90

Related product manuals