Main Content

ByteOrder

Specify byte order of instrument

Description

You configure ByteOrder to be littleEndian or bigEndian. If ByteOrder is littleEndian, then the instrument stores the first byte in the first memory address. If ByteOrder is bigEndian, then the instrument stores the last byte in the first memory address.

For example, suppose the hexadecimal value 4F52 is to be stored in instrument memory. Because this value consists of two bytes, 4F and 52, two memory locations are used. Using big-endian format, 4F is stored first in the lower storage address. Using little-endian format, 52 is stored first in the lower storage address.

Note

You should configure ByteOrder to the appropriate value for your instrument before performing a read or write operation. Refer to your instrument documentation for information about the order in which it stores bytes.

You can set this property on interface objects such as TCP/IP or GPIB. In this example, a TCP/IP object, Tobj, is set to bigEndian by default, and you change it to littleEndian.

Tobj.ByteOrder = 'littleEndian'

Characteristics

Usage

Any instrument object

Read only

Never

Data type

Character vector

Values

littleEndian

The byte order of the instrument is little-endian.

Default for serial, gpib, and visa objects.

bigEndian

The byte order of the instrument is big-endian.

Default for tcpip and udp objects.

Examples

This example shows how to set the byte order for a TCP/IP object.

Create a TCP/IP object associated with the host 127.0.0.1 and port 4000. Change the byte order from the default of bigEndian to littleEndian.

t = tcpip('127.0.0.1', 4000);
t.ByteOrder = 'littleEndian';

See Also

Properties

Status