Modbus Users Guide 2000584-001
Modbus Users Guide 2000584-001
Host/Analyzer Messages 3
Maxum edition II
Modbus Protocol Reference 4
PD PA AP
Modbus User's Guide Appendix A - Contact
A
Information
12/2019 (Rev 3)
2000584-001
Legal information
Warning notice system
This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent
damage to property. The notices referring to your personal safety are highlighted in the manual by a safety alert
symbol, notices referring only to property damage have no safety alert symbol. These notices shown below are
graded according to the degree of danger.
DANGER
indicates that death or severe personal injury will result if proper precautions are not taken.
WARNING
indicates that death or severe personal injury may result if proper precautions are not taken.
CAUTION
indicates that minor personal injury can result if proper precautions are not taken.
NOTICE
indicates that property damage can result if proper precautions are not taken.
If more than one degree of danger is present, the warning notice representing the highest degree of danger will be
used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating to property
damage.
Qualified Personnel
The product/system described in this documentation may be operated only by personnel qualified for the specific
task in accordance with the relevant documentation, in particular its warning notices and safety instructions. Qualified
personnel are those who, based on their training and experience, are capable of identifying risks and avoiding
potential hazards when working with these products/systems.
Proper use of Siemens products
Note the following:
WARNING
Siemens products may only be used for the applications described in the catalog and in the relevant technical
documentation. If products and components from other manufacturers are used, these must be recommended or
approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and
maintenance are required to ensure that the products operate safely and without any problems. The permissible
ambient conditions must be complied with. The information in the relevant documentation must be observed.
Trademarks
All names identified by ® are registered trademarks of Siemens AG. The remaining trademarks in this publication
may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.
Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and software described.
Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the information in this
publication is reviewed regularly and any necessary corrections are included in subsequent editions.
Siemens AG Document order number: 2000584-001 Rev3 Copyright © Siemens AG 2018 - 2019.
Division Process Industries and Drives Ⓟ 12/2019 Subject to change All rights reserved
Postfach 48 48
90026 NÜRNBERG
GERMANY
Table of contents
1 Overview.......................................................................................................................................................7
1.1 Security information .................................................................................................................7
1.2 Definitions ................................................................................................................................7
1.3 Modbus Operation....................................................................................................................8
1.4 Hardware Configuration ...........................................................................................................9
1.5 Serial Communication ..............................................................................................................9
1.6 Modbus TCP Configuration....................................................................................................10
1.7 Unit/Stream/Component Limits ..............................................................................................10
1.8 Component Values.................................................................................................................11
1.9 Scaled Results .......................................................................................................................11
1.10 Floating Point Results ............................................................................................................11
1.11 Status Information ..................................................................................................................11
1.12 Analyzer Alarms .....................................................................................................................12
1.13 NAU Alarms ...........................................................................................................................12
2 Modbus Address Map.................................................................................................................................13
2.1 Address Map Description .......................................................................................................13
2.2 General Address Map Rules ..................................................................................................13
2.3 Address Map Limits................................................................................................................14
2.4 Creating and Loading an Address Map..................................................................................14
2.5 Address Map Entries..............................................................................................................15
2.6 Sample Address Entries.........................................................................................................17
2.7 Example Address Map Configuration.....................................................................................18
2.8 Viewing and Editing the Address Map ...................................................................................19
2.9 Configure Analyzers to Transmit Results...............................................................................19
2.10 Special Instructions ................................................................................................................20
3 Host/Analyzer Messages............................................................................................................................21
3.1 Summary of Host/Analyzer Communication ..........................................................................21
3.2 AIREAD..................................................................................................................................21
3.3 ALARM...................................................................................................................................22
3.4 ANALYZERSTATUS ..............................................................................................................22
3.5 CALIBRATE ...........................................................................................................................23
3.6 CLEARALARM.......................................................................................................................23
3.7 CURRENTSTREAM...............................................................................................................23
3.8 CYCLELENGTH.....................................................................................................................24
3.9 DATE and Time......................................................................................................................24
3.10 DCHG.....................................................................................................................................25
3.11 DEDICATEDSTREAM ...........................................................................................................25
3.12 DIREAD..................................................................................................................................25
3.13 DOREAD................................................................................................................................25
3.14 DOSET...................................................................................................................................25
3.15 ECHG.....................................................................................................................................25
3.16 EUHI.......................................................................................................................................26
3.17 PROGRAMRUN.....................................................................................................................26
3.18 RDME.....................................................................................................................................26
3.19 RESULT .................................................................................................................................26
3.20 SCMIN, SCSEC, SCHR, SCDAY, SCMON, SCYR ...............................................................27
3.21 SELECTSTREAM ..................................................................................................................27
3.22 SKIPSTREAM ........................................................................................................................27
3.23 STANDBY ..............................................................................................................................28
4 Modbus Protocol Reference .......................................................................................................................29
4.1 Protocol Formats....................................................................................................................29
4.2 RTU vs. ASCII vs. TCP ..........................................................................................................29
4.3 Modicon Types.......................................................................................................................29
4.4 IEEE 32 Bit Float Format .......................................................................................................30
4.5 EUHI 16 Bit Float Format .......................................................................................................31
4.6 16-Bit Conversion Routines ...................................................................................................32
4.7 Communication Errors ...........................................................................................................33
4.8 Implementation of Modbus Protocol.......................................................................................33
4.9 Modbus Message Format ......................................................................................................34
4.10 Message Length.....................................................................................................................34
4.11 Message Content ...................................................................................................................35
4.12 Digitial Values ........................................................................................................................35
4.13 RTU Checksum......................................................................................................................36
4.14 Basic Data Types ...................................................................................................................36
4.15 Checksum and Communication Errors ..................................................................................36
4.16 CRC Lookup Table.................................................................................................................37
1.2 Definitions
Term Definition
Analyzer Any of the following units that support the Modbus slave protocol: Maxum
I, Maxum II, NAU, Advance Plus, MicroSAM
Coil Modicon term for a Boolean value, also described as a flag
Float A data element representing an Analog value using IEEE standard 32-bit
floating point format
DCS Host computer that is the Master
HCI-H (Host Computer Communications Interface – HIWAY) The Advance Opti‐
chrom system’s Modbus protocol interface
Host An external computer system which acts as the Modbus master and re‐
quests data from the Slave analyzer.
Master Modbus systems require one master device (host) which sends requests to
one or more slave devices
Modbus Communications protocol, defined in 1979 for Modicon Programmable
Logic Controllers, that has become a de facto standard for data communi‐
cations.
Modbus TCP Modbus variant used for communications over TCP/IP networks (different
from Modbus over TCP). Supported for software versions 5.0.7 and higher.
NAU (Network Access Unit ) Provides general purpose I/O for Siemens GC sys‐
tems. Any analyzer can be configured for this purpose, but it is recommen‐
ded that it be done on a dedicated unit.
Optichrom Siemens Advance Optichrom product line of gas analyzers and network
devices, the predecessor to the Siemens Maxum product line
Register term for a 16-bit 2’s complement integer value, also described as a Word
RTU (Remote Terminal Unit) Modbus RTU is a format where values are trans‐
mitted in binary form using serial communication links.
Slave Modbus device that passively waits for requests from a Modbus master
device
Maxum NAU
Maxum Modbus
Addmap
Ethernet Table
and Host
Maxum Advance Modbus
Data Driver RS 232
Hiway or
RS 485
Optichrom
These settings can be changed at any time prior to or during MODBUS communication.
MicroSAM requires a reset after changing any settings.
For MicroSAM, the unit must be configured for Modbus serial communication at startup.
Consult MicroSAM documentation for details.
The serial ports will be displayed. These are hard coded depending on the type of hardware
installed.
SYSCON1 - Port 1 is dedicated to Modbus
SYSCON2 - Ports 1, 3, and 4 are dedicated to Modbus
CIM - Port 1 is dedicated to Modbus
On the far right side of the display pane, set the details as needed for each serial port to be used
for serial Modbus communications. The drop-down menus for each attribute show the possible
values.
a,b,c,d,e,f (example--1:19200,n,8,1,n,232)
where
a = baud rate (50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
38400, 57600 or 115200)
b = parity (e for even, o or odd, or n for none)
c = data bits (7 or 8)
d = stop bits(1 or 2)
e = flow control(h for hardware, n for none)
f = 232 for RS-232, 485 for RS-485
When using MobbusTCP, the master(s) must be configured to use port 502 and the IP address
of the unit containing the Modbus tables. The slave address is not used for Modbus TCP.
Multiple masters can access the Modbus data on a single GC/NAU. The Maximum number of
Modbus TCP masters (connections) is 16.
Component numbers should be consecutive integers. Component numbers are assigned in the
order transmitted for Optichrom Advance or correspond to the trtval setting in the result table
for GCs.
Alarm Meaning
699 The analyzer tried to transmit a result or analyzer status that was not defined in the
address map.
700 The analyzer is not reachable or refuses connection. It will not receive a command
from the Host.
701 Scale factor or EUHI is missing.
703 The Host attempted to set an address that was not defined in the address map.
704 The Host has attempted a write to an address that is read-only.
705 Host command could not be directed to an address in the address map.
706 Can’t locate EUHI.
709 The Data_type does not match the value_type. Correction has been taken.
Or
Version 3.1and Above: The following format was developed for use by NAUs that are used
to gather results from 3rd party analyzers and transmit them to a host. This will allow for
running a MaxBasic program that transmits by frequency using the trtnow attribute in the
stream_method table. An application and streams will need to be created to create the
results in the result table. Store AI or other values in result table. Set up additional results
with these specific result names:
Analyzerstatus – set to status as in HCI-H (required)
Currentstream – set saved_value to the next stream
Standby - set to 1 for running, 0 for hold
Alarmstream - set for stream alarm
Alarmanlz – set to anlz alarm
Alarmapp – set ot application alarm
Dedicatedstream – set to dedicated stream
Cyclelength – set to cycle length
Skipstream – set saved value to stream that is enabled(positive)
or disabled(negative)
Calibrate – set to 1 if in calibration
Do NOT mark these for transmit, only mark the result’ s trtvals. Set values in these results.
Use type 7 for the host. This is a new free format used for Modbus, which allows you to be
free of entries in the actual tables. Example:
This will transmit 2 results, along with supporting information to the host.
Value_type Character (in many cases, only the first 2 characters are required,
see bold – Values are not case sensitive)
HOSTALIVE = host alive flag
RESULT = analyzer result value
CYCLELENGTH = length of cycle
EUHI = Euhi
RDME = readme flag
SELECTSTREAM = stream force flag
SKIPSTREAM = stream skip flag
DEDICATEDSTREAM = dedicated stream
CURRENTSTREAM = current stream flag
ANALYZERSTATUS = analyzer status
DCHG = database change flag
ECHG = euhi change flag
STANDBY = standby flag
CALIBRATE = calibration flag
PROGRAMRUN = execute event
DOSET = set a DO on the NAU
DIREAD = read a DI on the NAU
DOREAD = read a DO on the NAU
ALARM = fault alarm code
CLEARALARM = clear Maxum alams
Clock settings: SCMIN, SCHR, SCDAY, SCMON, SCYR
DATETIME – replaces DATE and TIME in Version 5.0.
Initvalue Character Initial value (not for results or EUHI)
Slave_address Integer Modbus Slave address
Euhi_address Integer Modbus address for EUHI
There are two special entries in the address map that set the "bad value" and the scale factor.
The scale factor will be used to calculate all scaled values (data_type S) in the address map.
These can be results, cycle_length, and analyzer status. The "bad value" is used when certain
conditions exist, as in the HCI-H. If the "bad value" is set to zero, no "bad value" processing is
done.
4, , ,B,1001,1,1,1, ,SKIP,0,1, ,
5, , ,B,1002,2,1,1, ,SKIP,0,1, ,
6, , ,B,1051,1,1,1, ,SEL,0,1, ,
7, , ,B,1052,2,1,1, ,SEL,0,1, ,
8, , ,B,1101,1,1,1, ,CU,0,1, ,
9, , ,B,1102,2,1,1, ,CU,0,1, ,
10, , ,B,1151,1,1,1, ,ECHG,0,1, ,
11, , ,B,1152,2,1,1, ,ECHG,0,1, ,
12, , ,B,1201,1,1,1, ,DCHG,0,1, ,
13, , ,B,1202,2,1,1, ,DCHG,0,1, ,
14, , ,B,1351,1,1,1, ,CAL,0,1, ,
15, , ,B,1352,2,1,1, ,CAL,0,1, ,
16, , ,B,1667,1,1, , ,SBY,0,1, ,
17, , ,B,1668,2,1, , ,SBY,0,1, ,
18, , ,B,11001,1,1,1, ,RDME,0,1, ,
19, , ,B,11002,2,1,1, ,RDME,0,1, ,
20, , ,S,30001,1,1, , ,AN,0,1, ,
21, , ,S,30002,2,1, , ,AN,0,1, ,
22, , ,S,30255,1,1, , ,CY,0,1, ,
23, , ,S,30256,2,1, , ,CY,0,1, ,
24, , ,S,30509,1,1, , ,DED,0,1, ,
25, , ,S,30510,2,1, , ,DED,0,1, ,
26, , ,S,41001,1,1,1,1,RES, ,1, ,31255
27, , ,S,41002,2,1,1,1,RES, ,1, ,31256
28, , ,E,41255,1,1,1,1,EUHI,1, ,
29, , ,E,41256,2,1,1,1,EUHI,1, ,
30, , ,Q,20001,1,1,1,2,RES, ,1, ,
31, , ,R,70003,2,1,1,2,RES, ,1, ,
Example Map
host Da‐ Address Anlz App Stream Res val‐ Init val‐ Slave1 EUHI
ta_Type ue_typ ue
e
1 sf 9999 1
2 bv 65535 1
3.2 AIREAD
AIREAD - Valid Addresses: 20001-49999, 70001-79999
AIREADs can be defined for each Application AI that is defined in the NAU’s application 999.
It is polled according to the Application AI setup. The value in the result designates the ID from
the APPAI table.
Values may be R or Q type. These require 2 consecutive registers (prior to Version 5.0 these
were not allowed to cross block boundaries, which are every 1000 registers):
Examples registers of consecutive AIREAD values:
40001, 40003
41999, 42000 (Not allowed prior to Version 5.0, since it crosses the block boundary).
3.3 ALARM
ALARM -
Valid Addresses: 30001-49999
The integer (data_type I) can be defined for each analyzer, analyzer/application, and analyzer/
application/stream. It contains the first alarm code for fault alarms.
Valid Addresses: 00001-19999
The boolean (data_type B) can be defined for each analyzer, analyzer/application, and
analyzer/application/stream. It contains the presence of alarms on the GC.
It is not possible to define a boolean and an integer with the same analyzer, analyzer/
application, and analyzer/application/stream.
Note that the ALARM defined for the analyzer corresponds directly with the red LED on the front
of the HMI. An integer type value will reflect the contents of the system_control table errors and
warnings attributes. This will be the last fault alarm that occurs or warning alarm, if there are no
faults.
An ALARM defined for the stream or application will reflect the contents of the curr_error
attribute in the stream and application table. These can only be cleared by the completion of a
cycle without alarms. This means that the analyzer ALARM can be zero, but the stream and
application can reflect an alarm condition.
3.4 ANALYZERSTATUS
ANALYZERSTATUS - Valid Addresses: 30001-49999
This integer or scaled integer (data_type I or S) value is defined for each application and
contains the stream status at the end of cycle. The status values can range from 0 to 1000, as
follows:
1000 normal, error free operation
9ss warning alarm on stream ss
7ss auto cal or validation running on stream ss
6ss manual cal running on stream ss
5ss Optichrom Advance change test exceeded on stream ss
4ss Optichrom Advance database change on stream ss
3ss Optichrom Advance excessive rate of change test failed on stream ss
3.5 CALIBRATE
CALIBRATE -
For Status: Valid Addresses: 0001-9999
This boolean (data_type B) can be defined for each analyzer/application/stream and is set by
the analyzer when the application is in manual or auto calibration. See Host operations in the
next section for a discussion of Host calibration control.
For Host Control: Valid Addresses: 0001-9999
The Host can direct an application to calibrate or stop calibrate by setting the calibrate flag,
defined on each analyzer/application/stream, for any stream in an application. If set by the
Host, a message is sent to the analyzer to place the application in auto calibration (1 or True)
or stop calibration (0 or False). In either case, if the analyzer is in hold, the command will be
ignored. If auto calibration is not enabled for the application, it will be placed in manual
calibration. Although each stream can be defined, it is recommended for only one stream (any
stream in the application). There may be operational differences for calibration when the
MODBUS interface is implemented for Advance Optichrom analyzers.
3.6 CLEARALARM
CLEARALARM - Valid Addresses: 0001-9999
This boolean (data_type B) can be defined for each analyzer, analyzer/application, and
analyzer/application/stream. The Analyzer will clear all alarms for the specified analyzer,
application, or stream. This flag is not operational for Advance Optichrom. . Note that clearing
alarms operates under the same constraints as clearing the alarms directly on the analyzer. If
stream or application alarms are cleared, record of them is still kept by the application and
stream until a cycle without alarms completes.
3.7 CURRENTSTREAM
CURRENTSTREAM -
Valid Addresses: 0001-9999
This boolean (data_type B) can be defined for each analyzer/application/stream and is set by
the analyzer. The flag tells the Host which stream will be the next to report.
Valid Addresses: 30001-49999
In Version 5.0+, CURRENTSTREAM can be defined as Integer type (I). In that case, the stream
is zero and the stream number is in the Value.
3.8 CYCLELENGTH
CYCLELENGTH - Valid Addresses: 30001-49999
This integer (data_type S or I) is set by the analyzer/application to be the longest cycletime in
the method table for an application, even unused methods. The longest cycle time is the stream
purge time + injection_lag + cycle length.
Version 5.0:
DATETIME is a unique type that designates a character string.
3.10 DCHG
DCHG - Valid Addresses: 0001-9999
This boolean (data_type B) can be defined with or without analyzer/application/stream and is
set when the scale factor changes. The flag is not reset when read by the Host. If defined for
stream 0, it is a summary flag for all streams. If stream 0 entry is set to 0, the flag will set all
stream DCHG flags for the application to 0.
3.11 DEDICATEDSTREAM
DEDICATEDSTREAM - Valid Addresses: 30001-49999
This integer (data_type S or I) can be defined for an analyzer/application and is set by the
analyzer. It tells the Host if a stream is running on a dedicated basis (Always). If the value is 0,
there is no dedicated stream.
3.12 DIREAD
DIREAD - Valid Addresses: 0001-19999
This boolean (data_type B) can be defined for each Application DI that is defined in the NAU’s
application 999. It is polled according to the Application DI setup. The value in the result field
designates the ID from the APPDI table.
3.13 DOREAD
DOREAD - Valid Addresses: 0001-19999
This boolean (data_type B) can be defined for each Application DO that is defined in the NAU’s
application 999. It is polled according to the Application DO setup(sys_do table has the
scanrate). The value in the result field designates the ID from the APPDO table.
3.14 DOSET
DOSET - Valid Addresses: 0001-9999
This boolean (data_type B) can be defined for each Application DO that is defined in the NAU’s
application 999. It can be set by the host to set the DO in the "on" position for the analyzer.
3.15 ECHG
ECHG - Valid Addresses: 0001-9999
This boolean (data_type B) can be defined for each analyzer/application/stream and is set
when the EUHI is changed from the analyzer or from host. Resetting is similar to the RDME.
If defined for stream 0, it is a summary flag for all streams in the application. If stream 0 entry
is set to 0, the flag will set all stream ECHG flags for the application to 0.
3.16 EUHI
EUHI -
From analyzer: Valid Addresses: 30001-49999
This is the full scale value for each scaled result. It is set for each transmitted result in the
analyzer’s result table. The default value is 100. It is sent to the Host as a 16-bit floating point
number, as in the HCI-H. The value is useful to the host to verify the full scale value used.
Additionally, the EUHI can be set by the Host to force synchronization and override any EUHI
set manually on the analyzer. EUHI values must be >= 1.0.
From Host: Valid Addresses: 40001-49999
The EUHI value for any result can be set by the Host in 16-bit floating point format. See the
section on the EUHI format. Version 3.0 requires that EUHI values be greater that 1.0.
3.17 PROGRAMRUN
PROGRAMRUN - Valid Addresses: 40001-49999
Registers can be defined for each analyzer/application/stream. The Analyzer runs the event
number that is indicated in the register for the designated stream
3.18 RDME
RDME - Valid Addresses: 0001-19999
This boolean (data_type B) can be defined for each analyzer/application/stream. It is set when
the analyzer transmits results for a stream. The flag tells the Host that there is new result data
available. For versions before 3.11, the flag automatically resets to zero after being read by the
Host after 3 seconds. These flags are stored in blocks of 1000 (1-1000, 1001-2000….). The
flag is reset after 20 seconds, regardless of host read. Each flag is reset independently. The 20
second default may be changed by setting the write_offset value in the Modbus_addmap table.
Zeroes for stream and application are allowed. This would allow all streams to share the same
RDME.
3.19 RESULT
RESULT - Valid Addresses: 20001-49999, 70001-79999
Expressed as a fraction of full scale (data_type S) or as a 32-bit float (data_type R). Designated
for transmission by the analyzer from the result table or from the Optichrom Advance analyzer.
A "bad value" is used, when defined in the map, when a condition on the analyzer suggests that
the values are not current or good. These conditions are:
● the result exceeds the EUHI
● the EUHI has changed
● analyzer status is < 500 (in fault alarm, out of service, or application time limit has expired)
● the stream is disabled.
Values may be R or Q type. These require 2 consecutive registers and, prior to Version 5.0,
may not cross block boundaries (which are every 1000 registers):
Examples registers of consecutive RESULT values:
40001, 40003
41999, 42000 is not allowed prior to Version 5.0, since it crosses the block boundary.
Zeroes for stream and application are allowed. This would allow all streams to share the same
RESULT addresses.
3.21 SELECTSTREAM
SELECTSTREAM - Valid Addresses: 0001-9999
This boolean (data_type B), defined on each analyzer/application/stream, can be set by the
Host to cause a Force Always condition (1 or True) or a Resume sequence (0 or False) on the
stream. The skipstream flag can be set to control stream enable/disable, as described in the
help topic for skipstream.
3.22 SKIPSTREAM
SKIPSTREAM - Valid Addresses: 0001-9999
This boolean (data_type B) can be defined for each analyzer/application/stream. It is set by the
analyzer and tells the Host if the stream is enabled (0 or False) or disabled (1 or True). If set by
the Host, this flag causes a message to be sent to the analyzer to disable or enable the stream.
3.23 STANDBY
STANDBY -
From Analyzer: Valid Addresses: 0001-9999
This boolean (data_type B) can be defined for each analyzer/application and is set by the
analyzer. The flag tells the host if the application is in hold, out of service, or disabled.
From DCS: Valid Addresses: 0001-9999
The Host can direct an application to start or stop running. If set by the Host, a message is sent
to the analyzer to place the application in hold (1 or True) or run (0 or False).
Modbus TCP utilizes standard TCP/IP messaging to transmit Modbus data. Modbus TCP is
distinct from Modbus over TCP. Modbus over TCP takes an entire Modbus RTU message and
encapsulates it within a TCP/IP message. Modbus TCP encapsulates only the data portion of
the Modbus message. Starting in software version 5.0.7, the Maxum family of products support
Modbus TCP. The Maxum family of products do not support Modbus over TCP.
Although the Modbus standard, defined by Modicon, does not specify how to send values other
than digitals or 16-bit 2’s complement integers, a frequent practice is to use the Modbus
protocol to other 16-bit values or to send 32-bit and 64-bit values as pairs and quadruples of
registers. For 32-bit and 64-bit values, the most significant 16-bit portion is sent as the first
register and the least significant 16-bit portion is sent as the last register. 32-bit IEEE floating
point format values are the most common deviation from the Modicon standard but sometimes
the values of 32-bit integers and 64-bit IEEE floats are transmitted this way.
The Modbus data model views each type of data as belonging to a separate data table. The
conventional notation for addresses specifies which table and the offset within the table. The
original ranges of the four main data types are:
● 00001 to 09999 for digital outputs (read and write) meaning table 0 with offsets 1 to 9999
● 10001 to 19999 for digital inputs (read only) meaning table 1 with offsets 1 to 9999
● 30001 to 39999 for analog inputs (read only) meaning table 3 with offsets 1 to 9999
● 40001 to 49999 for analog outputs (read and write) meaning table 4 with offsets 1 to 9999
Extended addresses may be supported in the future.
S Exponent Mantissa
3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
For example, the Master reads two floating point values from the registers 48601 through
48604, where the slave is identified as slave 65 (0x41). Translating this into a Modbus
command, this would be a request to read 4 registers starting at offset 8600 in table 4 of slave
65:
The Modbus will respond with a message sending the 4 16-bit words which contain the 2 32-bit
values:
In this example, the first value is 157.4 (0x431D6666) and the second value is –0.89
(0xBF63D70A).
The host system obtains the current value by making this conversion:
ResultValue = EUHI * Scaled Result/ ScaleFactor
The EUHI is represented using a special 16-bit floating point format derived from the IEEE 32-
bit floating point format. The sign bit is still the significant bit (0 for positive, 1 for negative). A 6-
bit exponent (bias 31) follows the sign bit. The mantissa occupies the 9 least significant bits.
The value 0x0000 represents 0.0. An exponent value of zero with a nonzero mantissa is similar
to the Not A Number (NAN) values of the IEEE 32-bit floating point format. Otherwise, the
exponent should have a value between 1 and 62, representing powers of 2 between –30 and
S Exponent Mantissa
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Byte 0 (Most Significant) Byte 1 (Less Significant)
16-Bit Word
Function Codes
These Modbus functions will be supported:
Exception Cause
Code
01 ILLEGAL FUNCTION (for Function Codes 00, 07, 09 to 14, 17 to 101, 102,
and 103 to 127)
02 ILLEGAL DATA ADDRESS (possible for Function Codes 01 to 06, 15, and 16)
03 ILLEGAL DATA VALUE (possible for Function Codes 05 and 08)
be packed into the third byte which would have the value 0x05 (00000101) because the most
significant 5 bits of the third byte would be set to zero (bit positions shown below)
One Modbus function sets the value of a single digital (Function 05 – Force Single Coil). This
particular function represents the value of ON by 0xFF00 (65023 decimal) and the value of OFF
by 0x0000 (zero).
Within a Modbus message, the values of 16-bit quantities are sent with the more significant byte
transmitted before the less significant byte. Note that this is opposite of the way Modbus RTU
transmits the CRC-16 checksum.
4800 7.29
9600 3.65
19200 1.823
38400 0.911
57600 0.608
112500 0.304
Function 05 Force Single Coil writes a value to a single digital output (table 0)
Function 06 Preset Single Register writes a value to a single analog output (table 4)
Function 15 Force Multiple Coils writes values to a string of digital outputs (table 0)
Function 16 Preset Multiple Registers writes values to a string of analog outputs (table 4)
Note: At least one of Function 05 and Function 15 will be implemented. Usually both are. At
least one of Function 06 and Function 16 will be implemented. Usually both are.
Function 08 Loopback Diagnostic Test diagnostic test message sent to test communica‐
tions
Function 11 Fetch Event Counter Com‐ check slave’s communications counter
munications
The other Modbus functions tend to be specific to models of Modicon PLC’s and are not
described here.
Slave Response
If the slave can process the command without error, the slave will respond with its identifier, the
function code, a count specifying the number of data bytes required to pack the digitals, and the
string of data bytes. For example:
Slave# Function Code Byte Count Data Byte 0 Data Byte 1 Data Byte 2 Data Byte 3 Data Byte 4
11 01 05 CD 6B B2 0E 1B
In this example,
● 0xCD (11001101) indicates that coils 00020, 00022, 00023, 00026, and 00027 are on.
● 0x6B (01101011) indicates that coils 00028, 00029, 00031, 00033, and 00034 are on.
● 0xB2 (10110010) indicates that coils 00037, 00040, 00041, and 00043 are on.
● 0x0E (00001110) indicates that coils 00045, 00046, and 00047 are on.
● 0x1B (00011011) indicates that coils 00052, 00053, 00055, and 00056 are on.
● All of the other coils are off (value of zero).
Note: the three most significant bits of data byte 4 (fifth byte) are all unused and are therefore
set to zero.
Possible Errors
Possible errors that could occur are:
● The specified starting address is outside of the configured range for table 0.
● The combination of specified starting address and number of digitals (quantity) would result
in an address outside of the configured range for table 0.
● The specified number of digitals (quantity) is too large to fit into a response. (A response can
hold a maximum of 255 data bytes or 2040 digitals.)
Error Response
Some devices limit the response length to 250 data bytes (2000 digitals). If one of the first two
errors occurs, an error response will be sent indicating that there is an ILLEGAL DATA
ADDRESS. If the third error occurs, an error response will be sent indicating that there is an
ILLEGAL DATA VALUE.
Using the example above slave 17 would respond to a command which had an illegal address
or an illegal combination of address and number of digitals (quantity) with:
Slave 17 would respond to a command specifying more than the allowable number of digitals
(quantity) with:
Slave Response
If the slave can process the command without error, the slave will respond with its identifier, the
function code, a count specifying the number of data bytes required to pack the digitals, and the
string of data bytes. For example:
Slave# Function Code Byte Count Data Byte 0 Data Byte 1 Data Byte 2
11 02 03 AC DB 35
In this example,
● 0xAC (10101100) indicates that inputs 10199, 10200, 10202, and 10204 are on.
● 0xDB (11011011) indicates that inputs 10205, 10206, 10208, 10209, 10211, and 10212 are
on.
● 0x35 (00110101) indicates that inputs 10213, 10215, 10217, and 10218 are on.
● All of the other inputs are off (value of zero).
Note: the two most significant bits of data byte 2 (third byte) are all unused and are therefore set
to zero.
Error Response
Similar to a Function Code 01, an ILLEGAL DATA ADDRESS error response will be sent if the
starting address or combination of starting address and number of digitals exceeds the
configured range of table 1 (digital inputs).
An ILLEGAL DATA VALUE error response will be sent if the number of digitals exceeds 2040,
the limit that can be packed into 255 data bytes for a response.
Note: some devices will limit the response length to 250 data bytes (2000 digitals). However,
the function code in the error response, will be 130 (0x82) indicating that the error occurred on
a command with Function Code 02.
Slave Response
If the slave can process the command without error, the slave will respond with its identifier, the
function code, a count specifying the number of data bytes required for the analogs, and the
string of data bytes. For example:
In this example, registers 40108, 40109, and 40110 have the values 555 (0x022B), 0 (0x0000),
and 100 (0x0064) respectively.
Error Response
Similar to Function Code 01, an ILLEGAL DATA ADDRESS error response will be sent if the
starting address or combination of starting address and number of analogs exceeds the
configured range of analog outputs (table 4).
An ILLEGAL DATA VALUE error response will be sent if the number of registers exceeds 127
which is the limit that can be packed into 254 data bytes for a response.
Note: Some devices limit the response length to 250 data bytes (125 registers). However, the
function code in the error response will be 131 (0x83), indicating that the error occurred on a
command with Function Code 03.
Slave Response
If the slave can process the command without error, the slave will respond with its identifier, the
function code, a count specifying the number of data bytes required for the analogs, and the
string of data bytes. For example:
Error Response
Similar to Function Code 01, an ILLEGAL DATA ADDRESS error response will be sent if the
starting address or combination of starting address and number of analogs exceeds the
configured range of table 3 (analog inputs).
An ILLEGAL DATA VALUE error response will be sent if the number of registers exceeds 127,
the limit that can be packed into 254 data bytes for a response.
Note: Some devices limit the response length to 250 data bytes (125 registers). However, the
function code in the error response will be 132 (0x84), indicating that the error occurred on a
command with Function Code 04.
The master sends a command writing the value of one output digital (table 0), specifying the
digital’s address and the value to write. For example, the master might request that slave 17
turn ON coil 00173. Translating the values into hexadecimal, this is a request that slave 0x11
write 0xFF00 to the coil at 0x00AC (corresponds to table offset 0173 of table 0):
Slave Response
If the slave can process the command without error, the slave will echo the command as a
response:
Possible Error
A possible error that might occur is that, although the address and data value are valid, there
is some internal error that prevents the digital value from being written to the specified digital.
For instance, the value may be on another device connected over an internal network. If the
other device is offline or has security features, which can block writing to that device’s digital,
this would cause a FAILURE IN ASSOCIATED DEVICE error response.
For example, if slave 17 had not been able to carry out the command because of an internal
system problem, the response would have been:
Similar to Function Code 01, an ILLEGAL DATA ADDRESS error response will be sent if the
coil’s address is outside the configured range of table 0 (digital outputs).
An ILLEGAL DATA VALUE error response will be sent if the digital value specified is neither
0xFF00 (ON) nor 0x0000 (OFF). However, the function code in the error response will be 133
(0x85) indicating that the error occurred on a command with Function Code 05.
Diagnostic Codes
Diagnostic Code 0
Return Query Data, is the most useful. This allows the host system (Modbus master) to test loop
communications and verify that the slave device can correctly generate checksum values
(CRC-16 for Modbus RTU and LRC for Modbus ASCII). Verifying the checksum requires
sending a series of Loopback Diagnostics Test messages with different 16-bit data values. The
addressed slave will send a response to this diagnostic code. The response should match the
message sent by the master, but a checksum will be generated by the slave and is not just an
echo of the command’s checksum.
Diagnostic Code 1
Restart Communications Option, tells the slave to reinitialize all serial communications
including clearing all event counters (message and error counters). After initialization, the slave
will resume waiting to be polled by the master. The slave does not send a response to this
diagnostic code. Modicon specifies two data values for this diagnostic code indicating whether
the slave should halt or continue when a communications error is detected. A data value of
0x0000 specifies the slave should halt on communications error. A value of 0xFF00 says the
slave should continue on communications error (but increment error event counters).
Note: For diagnostics on remote devices in SCADA systems, it is useful to halt the slave device
when an error occurs and then read a communications log (Function Code 12). Otherwise, the
Modbus implementation should ignore the data values for Diagnostic Code 1 (i.e., accept all
values).
Diagnostic Code 10
Clear Counters and Diagnostic Register, is useful if Function Code 11, Fetch Communications
Event Counter, is implemented. A Modbus slave increments the event counter for every
successful command from the Modbus master (i.e., commands that caused no errors). A
Modbus master can send a series of commands and then check the event counter to verify that
all were successful. This can be useful in testing a new configuration. The slave sends a
response that echoes the command from the master.
Error Response
The only error that should occur is that a command with an unsupported diagnostic code is sent.
If the slave does not recognize the diagnostic code, it should send an ILLEGAL DATA VALUE
error response (see Function Code 01 on page 43) with the Function Code set to 136 (0x88) to
indicate that the error occurred on a command with Function Code 08.
Error Example 1
The master sends Diagnostic Code 0 with data value 42295 (0xA537) to slave 17:
Error Example 2
The master sends Diagnostic Code 12 with data value 0 (zero) to slave 17:
The slave will respond with its identity, the function code, the diagnostic code, and the value of
the event counter (count of checksum errors), a value of 3 in this example:
Slave Response
If the slave can process the command without error, the slave will send a response with its
identity, the function code, the starting address, and the number of digitals (quantity) whose
values were set:
Error Response
Similar to Function Code 05, an ILLEGAL DATA ADDRESS error response will be sent if the
register’s address is outside the configured range of table 0 (digital outputs) or if the
combination of starting address and quantity results in an address outside of the configured
range.
A FAILURE IN ASSOCIATED DEVICE error response will be sent if an internal error prevented
the command from being carried out.
Normally there would not be an ILLEGAL DATA VALUE response because all values should be
acceptable. The function code in the error response will be 143 (0x8F) indicating that the error
occurred on a command with Function Code 15.
The master sends a command writing the values to a string of analog outputs (table 4),
specifying the starting address, the number of analog values, and the 16-bit values. The values
are sent with the more significant byte before the less significant byte.
For example, the master might set the values of the 2 registers 40136 and 40137 to 10
(0x000A) and 258 (0x0102) respectively in slave 17:
Slave Response
If the slave can process the command without error, the slave will send a response with its
identity, the function code, the starting address, and the number of analogs (quantity) whose
values were set:
Error Response
Similar to Function Code 05, an ILLEGAL DATA ADDRESS error response will be sent if the
register’s address is outside the configured range of table 4 (analog outputs) or if the
combination of starting address and quantity results in an address outside of the configured
range.
A FAILURE IN ASSOCIATED DEVICE error response will be sent if an internal error prevented
the command from being carried out.
Normally there would not be an ILLEGAL DATA VALUE response because all values should be
acceptable. The function code in the error response will be 144 (0x90) indicating that the error
occurred on a command with Function Code 16.
A.2 Contacts
Register at the Siemens Industry Online Support (SIOS) website:
https://support.industry.siemens.com
International USA
Siemens AG Siemens Industry, Inc.
I IA SC PA PM Process Analytics 5980 West Sam Houston Parkway North
Oestliche Rheinbrueckenstrasse 50 Suite 500
76187 Karlsruhe Houston, TX 77041
Germany USA
Web site: www.siemens.com/processanalytics Tel: +1 713 939 7400
Support Information: https://support.industry.siemens.com Fax: +1 713 939 9050
Spares Email: [email protected]
Contact your local Siemens sales representative Web site: www.usa.siemens.com/pa
Support Requests Training
Tel: +1 800 448 8224 (USA)
www.siemens.com/automation/support-request
Email: [email protected]
Spares
Tel: +1 800 448 8224 (USA)
Email: [email protected]
Support Requests
www.siemens.com/automation/support-request
Tel: +1 800 448 8224 (USA)
Email: [email protected]