FANUC Robotics America GFK-1541B User Manual

Page 132

Advertising
background image

GFK-1541B

Chapter 4 Programming Modbus/TCP Channel Commands

4-17

4

Command 3004, Example 1 – Set Single Register

Write one register from %AI10 to address 40200 in the remote Modbus/TCP server. Return the
COMMREQ Status word to %R10. Use channel 6, a channel previously opened with the Open
Modbus/TCP Client Connection COMMREQ.

Dec (Hex)

Word 1

00008 (0008)

Length of Channel command Data Block

Word 2

00000 (0000)

Always 0 (no-wait mode request)

Word 3

00008 (0008)

Memory type of CRS word (%R)

Word 4

00009 (0009)

CRS word address minus 1 (%R10)

*

Word 5

00000 (0000)

Reserved

Word 6

00000 (0000)

Reserved

Word 7

03004 (0BBC)

Write to a Modbus/TCP Device

Word 8

00006 (0006)

Channel number (6)

Word 9

00006 (0006)

Modbus Function Code – Preset Single Register

Word 10

00010 (000A)

Local PLC Memory Type

Word 11

00010 (000A)

Local PLC Starting Address

Word 12

00200 (00C8)

Address in the Remote Device

Word 13

00001 (0001)

Number of Registers in the Remote Device

Word 14

00001 (0001)

Unit Identifier

* Word 4 (CRS word address) is the only zero-based address in the Command Block. Only this

value requires subtracting 1 from the intended address.

(Word 7) Channel Command Number:

Word 7 identifies the COMMREQ as a Write Data to

remote Modbus/TCP device.

(Word 8) Channel Number:

Word 8 identifies the channel number previously allocated for

communication with the remote Modbus/TCP server.

(Word 9) Modbus Function Code:

Word 9 specifies Modbus Function Code 6, Preset Single

Register.

(Word 10) Local PLC Memory Type:

Words 10–11 specify the location in the local PLC from

where the Ethernet Interface will get the data to be written to the remote PLC. Valid values for
Word 10 are listed on page 4-14.

(Word 11) Local PLC Starting Address:

Word 11 determines the starting address in the local

PLC from which the data is to be written. The value entered is the offset (1-based) from the
beginning of PLC memory for the memory type and mode specified in Word 10. This offset will
be either in bits, bytes, or words depending on the mode specified. Valid ranges of values depend
on the PLC’s memory ranges.

(Word 12) Remote Device Address:

Word 12 specifies the destination register in the remote

device.

(Word 13) Number Registers in Remote Device:

Word 13 specifies the quantity of registers to

write to the remote device. For Modbus Function Code 6, Preset Single Register this must be set
to 1.

(Word 14) Unit Identifier:

Default is 1. This field is typically used by Ethernet to Serial bridges to

specify the address of a Modbus Slave on a multidrop link. The Modbus/TCP Unit Identifier is a
special control code used in a Modbus/TCP message block. This value is 1 for most Modbus/TCP
messages.

www.cadfamily.com EMail:[email protected]
The document is for study only,if tort to your rights,please inform us,we will delete

Advertising