:FORMat Subsystem

This subsystem contains commands that determine the formatting of numeric data when it is transferred.

The format setting affects data in specific commands only. If a command is affected, then it is noted in the command description.

:FORMat[:READings][:DATA] ASCii|INTeger,32|REAL,32

:FORMat[:READings][:DATA]?

:FORMat[:READings][:DATA]?

Title

Numeric Data Format

Description

This command specifies the format in which data is returned in certain commands.

ASCii format returns the data in comma-separated ASCII format. The units are the current instrument units. This format requires many more bytes so it is the slowest format. INTeger 32 values are signed 32-bit integers in little-endian byte order. This format returns the data in 4-byte blocks.

The units are always mdBm. For example, if the measured result were –12.345 dBm, that value would be sent as –12345.) REAL,32 values are 32-bit floating point numbers conforming to the IEEE 754 standard in little-endian byte order. This format returns the data in 4-byte binary format. The units are the current instrument units.

Both INTeger,32 and REAL,32 formats return a definite block length. Each transfer begins with an ASCII header such as #42204. The first digit represents the number of following digits in the header (in this example, 4). The remainder of the header indicates the number of bytes that follow the header (in this example, 2204). You then divide the number of following bytes by the number of bytes in the data format you’ve chosen (4 for both INTeger,32 and REAL,32) to get the number of data points (in this example, 551).

Parameter

ASCii|INTeger,32|REAL,32

Parameter Type

<char>

Default Value

ASCii

Related Command

:TRACe[:DATA]

Interpreting Returned Data Pair

The following section provides two conversion examples on interpreting returned data pairs. Examples are provided for both integer and real number formats.

Converting INTeger,32 and REAL,32 Values

• For a 551 point trace, the instrument returns 4415 bytes.

• The first 7 bytes make up the “header” information in ASCI format.

• The next 4408 bytes make up the actual data

(8 bytes x 551 datapoints = 4408 total bytes).

(8 bytes x 551 datapoints = 4408 total bytes).

• Each datapoint consists of 8 bytes.

• The first 4 bytes are the real component

• The next 4 bytes are the imaginary component.

• The returned value is in little endian format (the little end comes first).

• Negative numbers are represented in two’s compliment format.

• The data is scaled by a factor of 1e6.

Converting INTeger,32 Example:

The instrument returns the following S11 RL data point in INT,32 format:

4d 15 fc ff [real], ef a2 f8 ff [imag]

1. Convert from little endian to big endian:

ff fc 15 4d [real], ff f8 a2 ef [imag]

2. Since the MSb in both components is 1, they are negative numbers.

3. The binary representation is:

11111111111111000001010101001101 [real], 11111111111110001010001011101111 [imag]

4. Only perform this step on negative numbers noted in Step 2. Negate the two's complement negative number to a positive number (complement the bits and add 1):

111110101010110011 [real], 1110101110100010001 [imag]

5. Convert to decimal:

256691 [real], 482577 [imag]

6. If a number was negated in Step 4, it should be negated again:

-256691 [real], -482577 [imag]

7. Take out the 1e6 scale factor:

-0.256691 [real], -0.482577 [imag]

8. Finally, convert the values to dB:

10*log(-0.256691^2 + -0.482577^2) = -5.25 dB

Converting REAL,32 Example:

The instrument returns the following values in REAL,32 format:

00 31 2a 47 [real], 00 e8 6a c6 [imag]

1. Convert from little endian to big endian:

47 2a 31 00 [real], c6 6a e8 00 [imag]

2. The binary representation of the real portion, 47 2a 31 00 is:

01000111 00101010 01110001 00000000

3. Binary is in IEEE format:

• 1st bit is sign bit

• next 8 bits are exponent

• next 23 bits are normalized value

4. Convert binary to decimal:

0, the MSb is the sign bit

10001110, exponent. The actual exponent value is this value minus 127. So, it is 142 – 127 = 15.

0101010 01110001 00000000 (as normalized value) and adding 1 and multiplying by 2^exponent results in 1+(0/2+1/4+0/8+1/16+0/32+1/64+...) * 2^15 = 43520 (approx.)

c6 6a e8 00 in binary is 11000110 01101010 11101000 00000000

The MSb is the sign bit

The next 8 bits are the exponent, which is 10001100. The actual value is

140 – 127 = 13

140 – 127 = 13

Converting the remaining bits and multiplying by exponent and accounting for sign, results in –(1+(1/2+1/4+0/8+1/16+0/32+1/64...) * 2^13) = –14976 (approx).

6. Take out the 1e6 scale factor from both parts:

.043520 [real], –.014976 [imag]

7. Finally, convert the values to dB:

10*log((.043520)^2 + (-.014976)^2) = –26.7401848 dB