Vous êtes sur la page 1sur 7

The Modbus function codes shown below are from the Modicon Modbus Protocol Reference

Guide, PI-MBUS-300 Rev J.


The partial table shown below is from page 14 of the Indusoft help document for the MOTCP
driver v10.3.

The three function codes associated with the holding registers in the table are 03, 06, and 16.
Examples follow to illustrate the configuration that determines the use of each. Other function
codes are executed to read/write values associated with 0X, 1X and 3X addresses/data types.
Colored text denotes the following items in the Output Window’s Protocol Analyzer display.
Transaction Identifier Protocol Identifier Length Station Function Code Starting Address
Total Addresses Value(s)

Read Group 4X registers


Enable Read When Idle- All addresses in the range between the highest and lowest
configured addresses are read.
Values Read with Function Code 03 are 52 Hex (82 Decimal), 00 Hex (0 decimal) and 54
Hex (84 decimal)

[ID: 15F4] Tx:00 00 00 00 00 06 01 03 03 E9 00 03


[ID: 15F4] Rx:00 00 00 00 00 09 01 03 06 00 52 00 00 00 54
[ID: 15F4] MOTCP Read group: 10.168.23.65:502:1,4X:0 > Ok (Group number: 3)
Write Item 4X register
Enable Write on Tag change-Tag at 4X:1004 changed
Value written with Function Code 6 is 00 59 Hex (89 decimal)

[ID: 1938] Tx:00 00 00 00 00 06 01 06 03 EB 00 59


[ID: 1938] Rx:00 00 00 00 00 06 01 06 03 EB 00 59
[ID: 1938] MOTCP Write item: 10.168.23.65:502:1,4X:0,1004 Value: 89 > Ok (Group
number: 3)
Write Group 4X registers
Write Trigger-All addresses in the range between the highest and lowest configured
addresses are written.
Values written with Function Code 16 (10 Hex) are 00 53 Hex (83 Decimal) for 4X:1002,
00 00 Hex (0 decimal) for 4X:1003, and 00 55 Hex (85 decimal) for 4X:1004

[ID: 1938] Tx:00 00 00 00 00 0D 01 10 03 E9 00 03 06 00 53 00 00 00 55


[ID: 1938] Rx:00 00 00 00 00 06 01 10 03 E9 00 03
[ID: 1938] MOTCP Write group: 10.168.23.65:502:1,4X:0 > Ok (Group number: 3)

The Read and Write Protocol Analyzer data on the following pages was captured using
the Adroit Mod_RSSim Modbus Simulator package, and IWS’s MOTCP driver.
Data shown is for each read and write method available with this driver, for each of the
0X, 1X, 3X, 4X and FP modbus register types.
Mod_Sim

Discrete Outputs

Enable Read When Idle with 0X:1=1 Function Code 01

[ID: 16EC] Tx:00 00 00 00 00 06 01 01 00 00 00 01


[ID: 16EC] Rx:00 00 00 00 00 04 01 01 01 00
[ID: 16EC] MOTCP Read group: 10.168.23.52:502:1,0X:0 > Ok (Group number: 5)

Read Trigger with 0X:1=1 Function Code 01

[ID: 11C8] Tx:00 00 00 00 00 06 01 01 00 00 00 01


[ID: 11C8] Rx:00 00 00 00 00 04 01 01 01 00
[ID: 11C8] MOTCP Read group: 10.168.23.52:502:1,0X:0 > Ok (Group number: 5)

Enable Write on Tag Change with 0X:1=0 Function Code 05

[ID: 56C] Tx:00 00 00 00 00 06 01 05 00 00 00 00


[ID: 56C] Rx:00 00 00 00 00 06 01 05 00 00 00 00
[ID: 56C] MOTCP Write item: 10.168.23.52:502:1,0X:0,1 Value: 0 > Ok (Group number: 5)

Write Trigger with 0X:1=1 Function Code 15

[ID: 162C] Tx:00 00 00 00 00 08 01 0F 00 00 00 01 01 01


[ID: 162C] Rx:00 00 00 00 00 06 01 0F 00 00 00 01
[ID: 162C] MOTCP Write group: 10.168.23.52:502:1,0X:0 > Ok (Group number: 5)

*****************************************************************

Discrete Inputs

Enable Read When Idle with 1X:1=0 Function Code 02

[ID: 170C] Tx:00 00 00 00 00 06 01 02 00 00 00 01


[ID: 170C] Rx:00 00 00 00 00 04 01 02 01 00
[ID: 170C] MOTCP Read group: 10.168.23.52:502:1,1X:0 > Ok (Group number: 6)

Read Trigger with 1X:0=1 Function Code 02

[ID: 29C] Tx:00 00 00 00 00 06 01 02 00 00 00 01


[ID: 29C] Rx:00 00 00 00 00 04 01 02 01 01
[ID: 29C] MOTCP Read group: 10.168.23.52:502:1,1X:0 > Ok (Group number: 6)

*****************************************************************
Analog Inputs

Enable Read When Idle with 3X:1=88 Function Code 04

[ID: 15FC] Tx:00 00 00 00 00 06 01 04 00 00 00 01


[ID: 15FC] Rx:00 00 00 00 00 05 01 04 02 00 58
[ID: 15FC] MOTCP Read group: 10.168.23.52:502:1,3X:0 > Ok (Group number: 4)

Read Trigger with 3X:1=82 Function Code 04

[ID: 14C4] Tx:00 00 00 00 00 06 01 04 00 00 00 01


[ID: 14C4] Rx:00 00 00 00 00 05 01 04 02 00 52
[ID: 14C4] MOTCP Read group: 10.168.23.52:502:1,3X:0 > Ok (Group number: 4)

*****************************************************************

Analog Outputs Integers

Enable Read When Idle with 4X:1=82 Function Code 03

[ID: 1698] Tx:00 00 00 00 00 06 01 03 00 00 00 01


[ID: 1698] Rx:00 00 00 00 00 05 01 03 02 00 52
[ID: 1698] MOTCP Read group: 10.168.23.52:502:1,4X:0 > Ok (Group number: 3)

Read Trigger with 4X:1=88 Function Code 03

[ID: 9DC] Tx:00 00 00 00 00 06 01 03 00 00 00 01


[ID: 9DC] Rx:00 00 00 00 00 05 01 03 02 00 58
[ID: 9DC] MOTCP Read group: 10.168.23.52:502:1,4X:0 > Ok (Group number: 3)

Enable Write on Tag Change with 4X:1=82 Function Code 06

[ID: 168C] Tx:00 00 00 00 00 06 01 06 00 00 00 52


[ID: 168C] Rx:00 00 00 00 00 06 01 06 00 00 00 58
[ID: 168C] MOTCP Write item: 10.168.23.52:502:1,4X:0,1 Value: 82 > Ok (Group number: 3)

Write Trigger with 4X:1=88 Function Code 16

[ID: 1174] Tx:00 00 00 00 00 09 01 10 00 00 00 01 02 00 58


[ID: 1174] Rx:00 00 00 00 00 06 01 10 00 00 00 01
[ID: 1174] MOTCP Write group: 10.168.23.52:502:1,4X:0 > Ok (Group number: 3)

***************************************************************
Analog Output Floats

Enable Read When Idle with FP:4=98.6 Function Code 03

[ID: 880] Tx:00 00 00 00 00 06 01 03 00 03 00 02


[ID: 880] Rx:00 00 00 00 00 07 01 03 04 33 33 42 C5
[ID: 880] MOTCP Read group: 10.168.23.52:502:1,FP:0 > Ok (Group number: 2)

Read Trigger with FP:4=98.6 Function Code 03

[ID: 16EC] Tx:00 00 00 00 00 06 01 03 00 03 00 02


[ID: 16EC] Rx:00 00 00 00 00 07 01 03 04 33 33 42 C5
[ID: 16EC] MOTCP Read group: 10.168.23.52:502:1,FP:0 > Ok (Group number: 2)

Enable Write on Tag Change with FP:4=98.6 Function Code 16

[ID: 10F4] Tx:00 00 00 00 00 0B 01 10 00 03 00 02 04 33 33 42 C5


[ID: 10F4] Rx:00 00 00 00 00 06 01 10 00 03 00 02
[ID: 10F4] MOTCP Write item: 10.168.23.52:502:1,FP:0,4 Value: 98.600000 > Ok (Group
number: 2)

Write Trigger with FP:4=98.6 Function Code 16

[ID: 890] Tx:00 00 00 00 00 0B 01 10 00 03 00 02 04 33 33 42 C5


[ID: 890] Rx:00 00 00 00 00 06 01 10 00 03 00 02
[ID: 890] MOTCP Write group: 10.168.23.52:502:1,FP:0 > Ok (Group number: 2)

****************************************************************