
GPIB OPERATION | PROGRAMMING EXAMPLES |
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++;
}
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
/* The cal factor table output is in frequency, dB order for */ /* the whole table. The frequencies format is */
/*
/**/ 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] =
/* 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 |
|
|
|