beautypg.com

Format of api commands, Get commands, Command format response format – Perle Systems Perle IOLAN DS1 User Manual

Page 161

background image

161

Accessing I/O Data Via TruePort

Format of API Commands

There are two groups of commands:

z

Get Commands—Retrieve values of the I/O channel registers

z

Set Commands—Set values on the I/O channel registers.

I/O Channel registers are all assigned unique addresses, which need to be referenced in all of the
commands. Please refer to the documentation specific you the applicable mode, for the list and
addresses of all the registers.

Get Commands

The following tables show the general structure to be used for Get commands.

Command Format

Response Format

Note:

All commands need to be written to the COM port as a single write.

Model

Go to...

A4

A4/T4 Registers on page 155

T4

A4/T4 Registers on page 155

A4D2

A4D2/A4R2 Registers on page 156

A4R2

A4D2/A4R2 Registers on page 156

D4

D4/D2R2 Registers on page 157

D2/R2

D4/D2R2 Registers on page 157

Note:

Numeric values provided in the API documentation are in Hexadecimal (Hex) format.

Byte(s)

# of Bytes

Value

1

1

Command Code:

z

0x01 – Get “coils” (Boolean register)

z

0x03 – Get “holding registers” (R/W registers)

z

0x04 – Get “input registers” (R only register)

2-3

2

Starting register number (see

A4/T4 Registers on page 155

,

A4D2/A4R2 Registers on page 156

, or

D4/D2R2 Registers on page 157

for this value).

4-5

2

Number of registers to read. If this value is greater than 1, the response
will contain the values of multiple consecutive registers.

Byte(s)

# of Bytes

Value

1

1

Command that this is a response to. If an error has been detected, the
command value will have the high bit set (OR with 0x80). For
example: The command is 0x04, so the command field in the response
would be 0x84.

2

1

Length of data (in bytes) starting in next byte.

3-n

n

Requested register values.

This manual is related to the following products: