GPIB Operation Programming Examples
ML2437A/38A OM/PM PN: 10585-00001 Rev. P 8-137
/* Get length of binary data */
for (loop = 0; loop < count; loop++)
{
ch_val[loop] = *cptr++;
}
ch_val[count] = NULL;
length = atoi(&ch_val[0]);
/* If reading in a binary graph the data will be in */
/* 1024LONG format. In this format each of the graph */
/* values are held as the dB value multiplied by 1024 */
/* and held in LONG form. */
/**/
/* Each long is 4 byte in length. To read and transpose
the values into real dB values each set of 4 bytes
are read into a long variable and then cast into a
float type and then divided by 1024.
*/
count = 0;
loop = 0;
bin_value = (long *)cptr; /* Set the long pointer */
/* Read and cast the data */
while (count < length)
{
real_data1[loop++] = ((float)(*bin_value++))/1024.0;
count += 4;
}
real1_entries = loop;
}
else if (decode_type == OFFSET_TABLE_BINARY_DATA)
{
/* Decode header */
/* Find # character. */
cptr = strtok(&buffer[0],"#");