PROGRAMMING EXAMPLES

GPIB OPERATION

/* 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],"#"); cptr = strtok(NULL,"#");

/* Get the number of characters for binary length */ ch_val[0] = *cptr++;

ch_val[1] = NULL; count = atoi(&ch_val[0]);

/* Get length of binary data */

for (loop = 0; loop < count; loop++)

{

ch_val[loop] = *cptr++;

}

ch_val[count] = NULL; length = atoi(&ch_val[0]);

*cptr++; /* Read past comma for offset tables. */

/* The binary offset table is 200 sets frequency and dB */ /* These are held in single precision floating point. */ /* To convert to the real values, re-order the bytes. */

/**/ count = 0;

loop = 0;

while (count < length)

{

/* Frequency conversion */ bin_data.cval[2] = *cptr++; bin_data.cval[3] = *cptr++; bin_data.cval[0] = *cptr++; bin_data.cval[1] = *cptr++;

real_data1[loop] = bin_data.fval;

/* dB conversion */

bin_data.cval[2] = *cptr++; bin_data.cval[3] = *cptr++; bin_data.cval[0] = *cptr++; bin_data.cval[1] = *cptr++;

real_data2[loop++] = bin_data.fval; count += 8;

}

real1_entries = loop; real2_entries = loop;

}

6-134

ML2430A OM

 

 

Page 221
Image 221
Anritsu operation manual 134 ML2430A OM