Click or drag to resize

Formatting Integer Output Parameters

Integers used as output parameters from method and property responses can be formatted in a variety of ways. Scalar integer parameters are read from the instrument as ASCII text and converted to numeric values. Integer arrays can be read from the instrument in the following formats:

  • An ASCII list of values separated by commas or another specified delimiter.

  • An IEEE 488.2 binary block.

  • A stream of raw binary data.

This topic presents the format specifications for reading data from the device as ASCII text. For detailed information on reading array data as IEEE binary blocks, see the topic Reading and Writing IEEE 488.2 Binary Block Data. For information on sending array data as raw binary, see the topic Reading and Writing Raw Binary Data.

Integers used as output parameters have format specifications of the following general form:

%[488.2 type] [delimiter] [d | o | x ]

Modifier

Interpretation

488.2 type

The number is expected to be in one of six standard IEEE 488.2 numeric formats. The supported formats are:

  • @1 - IEEE 488.2 NR1 format (integer without any decimal point). Example: 123

  • @2 - IEEE 488.2 NR2 format (number with at least one digit after the decimal point). Example: 123.45

  • @3 - IEEE 488.2 NR3 format (floating-point number in exponential form). Example: 1.2345E-67

  • @H - IEEE 488.2 hex format. Example: #HAF35B

  • @Q - IEEE 488.2 octal format. Example: #Q71234

  • @B - IEEE 488.2 binary format. Example: #B011101001

delimiter

The parameter must be an array of integers. The instrument response is interpreted as a delimited list of integers, where delimiter specifies the delimiter character.

The following delimiters are supported. Note that the enclosing parentheses are not required for comma-separated lists:

  • , or (,) - comma-separated list

  • (;) - semicolon-separated list

  • (:) - colon-separated list

  • (s) - space-separated list

  • (t) - tab-separated list

  • (r) - carriage return-separated list

  • (n) - linefeed-separated list

type

  • d - number is formatted as a decimal integer.

  • o - number is formatted as an octal integer.

  • x - number is formatted as a hex integer.

Examples: Output Integer Parameter

Parameter Tag

Data Expected from Device

{Count:%d}

Data from device:

3.14

Data copied to output parameter:

3

{Count:%@Hd}

Data from device:

#H34E8

Data copied to output parameter:

13544 (decimal)

{CountArray:%@B,d}

Data from device:

#B101,#B110,#B111

Data copied to output parameter:

CountArray[0]: 5 (decimal)

CountArray[1]: 6 (decimal)

CountArray[2]: 7 (decimal)

See Also

Download a complete CHM version of this documentation here.