500 Modbus
500 Modbus
500 Modbus
2016)
-1-
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
COPYRIGHT NOTICE
Any unauthorized use or copying of the contents or any part of this document is prohibited.
This applies in particular to trademarks, model denominations, part numbers and drawings.
This document describes minimum required details for the successfull interfacing of the D-500/700 family
units to 3rd party Modbus and Modbus-TCP/IP based applications.
Follow carefully advices given in the document. These are often good practices for the installation of
genset control units which reduce future issues.
For all technical queries please contact Datakom at below e-mail address:
datakom@datakom.com.tr
This document will apply to both Modbus through RS-485 and Modbus-TCP/IP communications.
RELATED DOCUMENTS
FILENAME DESCRIPTION
500-USER D-500 D-700 User Manual
500-Ethernet Configuration Ethernet Configuration Guide for D-500 D-700
500-GSM Configuration GSM Configuration Guide for D-500 D-700
REVISION HISTORY
TERMINOLOGY
-2-
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
The Modbus communication is widely used in the connection of industrial control units to various
management systems for remote monitoring and control. It has begun the basic industry standard in the
last decades.
D-series units offer the possibility of MODBUS communication through below carriers:
-RS485 serial port, with adjustable baud rate between 2400 and 115200 bauds
-RS232 serial port, with adjustable baud rate between 2400 and 57600/115200 bauds
-MODBUS-TCP/IP through Ethernet port (10/100Mb)
-MODBUS-TCP/IP through GSM-GPRS modem. (85kb/s)
Detailed description about the MODBUS protocol is found in the document “Modicon Modbus Protocol
Reference Guide”. This document may be downloaded at: www.modbus.org/docs/PI_MBUS_300.pdf
Detailed description about the MODBUS-TCP/IP protocol is found in the document “MODBUS
APPLICATION PROTOCOL SPECIFICATION”. This document may be downloaded at:
http://www.modbus.org/docs/Modbus_Application_Protocol_V1_1b.pdf
Each register consists of 2 bytes (16 bits). A larger data structure will contain multiple registers.
MODBUS CONFIGURATION
The Modbus communications requires a slave address to be assigned to each device in the Modbus
network. This address ranges between 1 and 240 and allows the addressing of different slave devices in
the same network.
-3-
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
The complete RS-485 and RS-232 port specifications are found in the D-500/700 User Manual.
Selecting a higher baud rate will allow faster communication, but will reduce the communication distance.
Selecting a lower baud rate will increase the communication distance, but will cause slower response
times.
Typically 9600 bauds will allow 1200m distance with special balanced 120 ohms low capacitance cable.
Modbus Slave Address: may be set between 1 and 240. If only one unit is available in the same IP
address, it is advised to keep the default address (1).
Ethernet Enable: This parameter should be set to 1 (or checked) in order to enable the ethernet port.
Modbus TCP/IP Port: The usual setting is 502. However the unit is able to work on any port address.
User IP Mask: There are 3 mask registers available. The use of the registers are emphasized in the D-
500/700 User Manual. Please set the first mask as 255.255.255.0 for the proper operation.
Ethernet Network IP: May be left as 0.0.0.0 for automatic address claim or set to a value in order to claim
a defined address.
Ethernet Gateway IP: Should be set in accordance with your local switch configuration.
Ethernet Subnet Mask: Should be set in accordance with your local switch configuration.
The complete Ethernet port specifications are found in the D-500/700 User Manual.
Please rewiev the document Ethernet Configuration Guide for D-500/700 for more details about the
ethernet port setup.
Modbus Slave Address: may be set between 1 and 240. If only one unit is available in the same IP
address, it is advised to keep the default address (1).
Modem Selection: Internal or external following your configuration.
Modem Baud Rate: Selectable only for external modem. 115200 bauds advised. Selecting a lower baud
rate will slow down communication between the controller and the modem.
GPRS Connection Enable: This parameter should be set to 1 (or checked).
Modbus TCP/IP Port: Set this value to 80.
User IP Mask: There are 3 mask registers available. The use of the registers are emphasized in the D-
500/700 User Manual. Please set the first mask as 255.255.255.0 for the proper operation.
-4-
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
Modbus
address Modbus-TCP/IP
port
Modem Modem
Selection Baud Rate
RS-485
port enable RS-485
Baud Rate
-5-
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
User IP
Masks
Ethernet
port enable
Ethernet IP
address
Ethernet
gateway IP
Ethernet
subnet
mask
GPRS
enable
-6-
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
DATA READING
The function 03 (read multiple registers) will be used for data reading. The MODBUS master will send a
query. The answer will be one of the below:
-A response containing the requested data
-An exceptional response indicating a read error.
The maximum number of registers read in one message is 16. If more registers are requested, the
unit will send only the first 16 registers.
The query message specifies the starting register and quantity of registers to be read. The
message structure is below:
Here is the sequence to read 16 registers starting from address 20h (32 decimal):
01 03 00 20 00 10 45 CC (each byte is expressed as 2 hexadecimal characters)
The checksum value in the above message may be used for the verification of checksum
calculation algorithm.
-7-
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
The function 06 (write single register) and the function 16 (write multiple registers) are used for data
writing.
The MODBUS master will send a query containing data to be written. The answer will be one of the below:
-A normal response confirming successful write,
-An exceptional response indicating a write error.
Only some of the available registers are authorized to be written. An attempt to write a write protected
register will result to the exceptional response.
The query message specifies the register address and data. The message structure is below:
Here is the sequence to write the value 0010h to the register 40h (64 decimal):
01 06 00 40 00 10 89 D2 (each byte is expressed as 2 hexadecimal characters)
The checksum value in the above message may be used for the verification of checksum calculation
algorithm
-8-
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
The function 06 (write single register) and the function 16 (write multiple registers) are used for data
writing.
The MODBUS master will send a query containing data to be written. The answer will be one of the below:
-A normal response confirming successful write,
-An exceptional response indicating a write error.
Only some of the available registers are authorized to be written. An attempt to write a write protected
register will result to the exceptional response.
The query message specifies the register address and data. The message structure is below:
-9-
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
CRC CALCULATION
1) Load a 16–bit register with FFFF hex (all 1’s). Call this the CRC register.
2) Exclusive OR the first 8–bit byte of the message (the function code byte) with the low–order byte of the
16–bit CRC register, putting the result in the CRC register.
3) Shift the CRC register one bit to the right (toward the LSB), zero–filling the MSB. Extract and examine
the LSB. The LSB is the least significant bit of the CRC before the shift operation.
4) If the LSB is 1: Exclusive OR the CRC register with the polynomial value A001 hex.
5) Repeat Steps 3 and 4 until 8 shifts have been performed. Thus, a complete 8–bit byte will be processed.
6) Repeat Steps 2 through 5 for the next 8–bit byte of the message. Continue doing this until all bytes have
been processed.
8) Place the CRC into the message such that the low byte is transmitted first. The algorithm should give
the correct CRC for below messages:
01 03 00 20 00 10 45 CC
01 06 00 40 00 10 89 D2
Error codes
Only 3 error codes are used:
01: illegal function code
02: illegal address
10: write protection (attempt to write a read_only register)
Data types
Each register consists of 16 bits (2 bytes)
If the data type is a byte, only the low byte will contain valid data. High byte is don’t care.
For data type longer than 16 bits, consecutive registers are used. The least significant register
comes first.
DATA FORMATS
16bit variables: These variables are stored in a single register. Bit_0 denotes the LSB and bit 15 denotes
the MSB.
32 bit variables: These variables are stored in 2 consecutive registers. The high order 16 bits are in the
first register and the low order 16 bits are in the second register
Bit arrays: Arrays larger than 16 bits are stored in multiple registers. The LSB of the first register is bit_0.
The MSB of the first register is bit_15. The LSB of the second register is bit_16. The MSB of the second
register is bit_31, and so on.
- 10 -
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
REGISTER DEFINITIONS
- 11 -
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
- 12 -
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
- 13 -
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
- 14 -
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
- 15 -
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
- 16 -
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
- 17 -
D-300 / 500 / 700 Modbus Application Manual V5.6 (25.04.2016)
- 18 -