else if (decode_type == CAL_FACTOR_BINARY_DATA)
{
/* Decode header */
/* Read length of binary data*/
ch_val[0] = buffer[6];
ch_val[1] = buffer[7];
ch_val[2] = NULL;
length = atoi(ch_val);
/* Point after the comma */
cptr = &buffer[9];
/* Read the table identity */
count = 8;
for (loop = 0; loop < count; loop++)
{
ident[loop] = *cptr++;
length—;
}
ident[count] = NULL;
/* Read number of entries*/
bin_data.cval[0] = *cptr++;
bin_data.cval[1] = *cptr++;
bin_data.cval[2] = 0;
bin_data.cval[3] = 0;
table_entries = bin_data.ival;
length -= 2;
/* The cal factor table output is in frequency, dB order for */
/* the whole table. The frequencies format is */
/* 32768.0e-6LONG and the dBs are held in 1024INT format. */
/* */
count = 0;
loop = 0;
while (count < length)
{
/* Frequency conversion */
bin_data.cval[0] = *cptr++;
bin_data.cval[1] = *cptr++;
bin_data.cval[2] = *cptr++;
bin_data.cval[3] = *cptr++;
real_data1[loop] = ((float)(bin_data.lval))/32768e-6;
/* dB conversion */
bin_data.cval[0] = *cptr++;
bin_data.cval[1] = *cptr++;
bin_data.cval[2] = 0;
bin_data.cval[3] = 0;
real_data2[loop++] = ((float)(bin_data.ival))/1024.0;
count += 6;
}
real1_entries = loop;
real2_entries = loop;
}
}
ML2430A OM 6-135
GPIB OPERATION PROGRAMMING EXAMPLES