E-2. Floating Point Conversion - Fluke 2620A User Manual

Hydra series ii data acquisition unit, hydra series ii data logger
Hide thumbs Also See for 2620A:
Table of Contents

Advertisement

/* Import globals from main program */
extern int timestamp[];
extern int misc[];
extern float values[];
/*
-* convert(): Convert a LOG_BIN? array of binary data into useful data
**
** Converts BCD values to integer, raw floating point values into float
** values usable under the Intel x86 (IBM PC) architecture.
**
** Inputs:
**
src
**
length
**
** Outputs:
**
timestamp[]
**
misc[]
**
values[]
**
*/
void
convert(src, length)
unsigned char *src;
int length;
{
unsigned char *m;
int n;
/* Convert timestamp from BCD to decimal */
for (n=0; n < 6; n++, src++) {
/* Binary Coded Decimal (BCD) format, packs the upper nibble as the
*/
/* tens digit, the lower nibble as the ones digit.
*/
/* into an integer number.
*/
timestamp[n] = (10 * (*src >> 4) + (*src & 0x0f));
}
/* Save temperature units, measurement rate, and digital I/O values */
for (n=0; n < 3; n++) {
misc[n] = *src++;
}
/* Convert raw measurement data into floating point */
m = (unsigned char *)values;
for (length -= 9; length > 3; length -= 4) {
#ifdef sun
/* SunOS architecture (also works for Motorola CPUs) */
*m++ = src[0];
*m++ = src[1];
*m++ = src[2];
*m++ = src[3];
#else
/* Assume Intel x86 architecture */
*m++ = src[3];
*m++ = src[2];
*m++ = src[1];
*m++ = src[0];
#endif
src += 4;
}
}
Figure E-2. Floating Point Conversion
Binary Upload of Logged Data (LOG_BIN?) (2625A only)
Array of binary data, from LOG_BIN? query
Number of bytes in src array
Set to decimal timestamp values
Set to temp units, rate, and digital I/O values
Set to floating point values found in binary data
(must be room for a maximum of 22 floats)
Appendices
Convert this
E
E-5

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

2625a

Table of Contents