beautypg.com

Mb (modbus), Commands, because they – Yaskawa LEGEND-MC User Manual

Page 170

background image

160

LEGEND-MC User’s Manual

MB (Modbus)

[I/O]

DESCRIPTION:

The MB command is used to communicate with I/O devices using the first two levels of the Modbus
protocol.

The format of the command varies depending on each function code. The function code, -1, designates that
the first level of Modbus is used (creates raw packets and receives raw data). The other codes are the 10
major function codes of the second level that the LEGEND-MC supports.

NOTE: For those command formats that have “addr”, this is the slave address. The slave address
may be designated or defaulted to the device handle number.

NOTE: All formats contain an h parameter. This designates connection handle number (A thru P).

ARGUMENTS:

Function

Meaning

Example

-1

Raw Packets

MBh = -1, y, array

[ ]

1

Read Coil Status

MBh = a, 1, t, b, array

[ ]

2

Read Input Status

MBh = a, 2 , t, b, array

[ ]

3

Read Holding Registers

MBh = a, 3, e, r, array

[ ]

4

Read Input Registers

MBh = a, 4, e, r, array

[ ]

5

Write Single Coil

MBh = a, 5, t, c

6

Write Single Register

MBh = a, 6,g, s

7

Read Exception Status

MBh = a, 7, array

[ ]

15

Write Multiple Coils

MBh = a, 15, t, b, array

[ ]

16

Write Multiple Registers

MBh = a, 16, e, r, array

[ ]

17

Report Slave ID

MBh = a, 17, array

[ ]

Argument

Description

Argument

Description

a

Slave address

h

Connection handle number

array

[ ]

Name of array containing data

r

Number of registers

b

Number of bits

s

16 bit value

c

0 or 1 (to turn coil OFF or ON)

t

Starting bit number

e

Starting register

y

Number of bytes

g

Register number