FAQs from Rohde & Schwarz

What is the Structure of FSE/FSIQ Trace Data on the GPIB?


How to convert the binary trace result from the GPIB using the command 'TRAC? TRACE1' ?


The default format after *RST is the ASCII format. That means you will get 500

ASCII values, which are separated by commas, in a single string (approx . 6 Kbyte)

that is terminated by a line feed (0A hex).

To use the floating point format you have to send the command "FORMAT REAL,32"


The FSE will answer the query "TRAC? TRACE1" with a binary string of 500 float

values. Each value is in the IEEE 754 single-precision 4 byte (32 bit) format

that is used by almost all compilers (even with Visual Basic).

Therefore no conversion has to be performed, which saves a lot of processing

time. All values are sent with the low byte first, which is the byte order in the

PC world - for HP workstations please check.

The binary string is formatted according to the <Definite Length Arbitrary Block

Response Data> described in the IEEE 488.2 standard.

This format has to be used together with the preceding length information

if an instrument response is in binary format.

The encoding syntax is the ASCII sign # followed by a non-zero digit. This

digit indicates the number of digits that follow and together specify the

length of the binary information. In the case of FSE the preceding

length information is "#42000...", which means 2000 bytes (500 x 4 bytes) of

binary information.

The C programming example below uses a single-precision FLOAT array to read

the information without any conversion from the IEEE bus. The preceding length

information is simply skipped by a 6-byte offset in the array.

/* DEFINES ****************************************************************/

#define MAX_NOF_POINTS 500 // max. number of points per sweep

#define MAX_NOF_DATA_BYTES (MAX_NOF_POINTS * sizeof(float) + 100)

/* VARIABLES **************************************************************/

UINT8 sweep_data[MAX_NOF_DATA_BYTES]; // stores the data loaded from FSEx

float *sweep_data_ptr= (float *)sweep_data; // pointer to sweep_data

/* Procedures **************************************************************/

int read_sweep_data(void)


SPECIFICATION: read new data from FSEx

Trace data in binary format are 500 float values (2000 bytes)

preceded by 6 bytes

which are used as a length specifier (IEEE488.2 format):




RETURN VALUES: 0 if successful

1 if there was any error



if (write_to_analyzer("FORMAT REAL32;:TRAC? TRACE1")) // send data of Trace

1 in binary format


sprintf(error_msg, "IEEE-Error: TRAC? TRACE1");

return 1; // there was an error


if (read_from_analyzer(sweep_data, MAX_NOF_DATA_BYTES))


sprintf(error_msg, "IEEE-Error: reading sweep data");

return 1; // there was an error


if ( (ibcnt < 2006) || (ibcnt > 2007) ) // number of received bytes


sprintf(error_msg, "IEEE-Error: reading sweep data (incorrect byte count)");

return 1; // there was an error


sweep_data_ptr= (float *) &sweep_data[6]; // set pointer to data start

return 0;