Programming Examples

2. REAL Data Format

This program uses the REAL data format to speed up the measurement.

/* IEEE 488.2 binary real format follows the ‘little-endian’ format with the most-significant byte first and the least-significant byte last. Intel processors use the ‘big-endian’ format, with the least-significant byte first, so we have to reverse the byte order of the incoming block when running on a PC (Intel processor).

#include

“decl.h”

#include

<stdio.h>

#include

<process.h>

#include <conio.h>

main ()

 

{

 

int

Counter, i;

char

InString[80];

double

DoubleFreq;

Counter = ibfind(“DEV10");

/*Make the counter output it’s result in real format*/ ibwrt(Counter, “:FORM REAL”, 10);

/*Make continuous measurements until a key is hit*/ do {

/*Make a measurement and read the result*/ ibwrt(Counter, “READ?”, 5); ibrd(Counter, InString, 80);

/*Assign the bytes 3...10 of InString to DoubleFreq bytes 7...0.

The format of InString is #18******** , where “********” represents the value.*/

for (i=0; i<8; i++)

((unsigned char *)&DoubleFreq)[7-i] = InString[3+i];

/*Print the result*/ printf(“%le\n”, DoubleFreq);

} while (!kbhit());

/*Restore ascii output format*/ ibwrt(Counter, “:FORM ASCII”, 11);

exit(0);

}

‘C’ for National Instruments PC-IIA, Real Data Format 4-15

Page 55
Image 55
Fluke PM6681R, PM6685R manual ‘C’ for National Instruments PC-IIA, Real Data Format