EasyManua.ls Logo

Pendulum CNT-91 - Page 58

Default Icon
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...
// 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's 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;
}
// 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;
Programming Examples
4-22 Error Code

Table of Contents

Other manuals for Pendulum CNT-91

Related product manuals