DKG-309 / 319 / 507-J / 517-J / 527 / 537 DKG-543 / 547 / 553 / 557 Modbus Application Manual
DKG-309 / 319 / 507-J / 517-J / 527 / 537 DKG-543 / 547 / 553 / 557 Modbus Application Manual
DKG-309 / 319 / 507-J / 517-J / 527 / 537 DKG-543 / 547 / 553 / 557 Modbus Application Manual
2007)
Tel: +90-216-466 84 60
Fax: +90-216 364 65 65
[email protected]
http://www.datakom.com.tr
-1-
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)
MODBUS COMMUNICATION
The unit offers the possibility of MODBUS communication via its RS232 serial port.
The MODBUS mode is activated by assigning a controller address to the unit using parameter
P_057. The possible address range is 1 to 144. Setting the address 0 will disable the MODBUS mode and
allow communication under RAINBOW protocol.
Each register consists of 2 bytes (16 bits). Larger data structure contain multiple registers.
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
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.
-2-
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)
Data Writing
The function 06 (write single register) is used for data writing. Only one register can be written at
a time.
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
-3-
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)
CRC calculation
Here is a procedure for generating a CRC:
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.
-4-
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)
Register definitions
ADDRESS R/ DATA COEFFICIENT DESCRIPTION
(hex) W SIZE
0000 R 16bit x1 Phase R voltage
0001 R 16bit x1 Phase S voltage
0002 R 16bit x1 Phase T voltage
0003 R 16bit x1 Phase U voltage
0004 R 16bit x1 Phase V voltage
0005 R 16bit x1 Phase W voltage
0006 R 16bit x1 Phase U current
0007 R 16bit x1 Phase V current
0008 R 16bit x1 Phase W current
000C R 16bit x1 Phase RS voltage
000D R 16bit x1 Phase ST voltage
000E R 16bit x1 Phase TR voltage
000F R 16bit x1 Phase UV voltage
0010 R 16bit x1 Phase VW voltage
0011 R 16bit x1 Phase WU voltage
0012 R 16bit x10 Mains frequency
0013 R 16bit x10 Genset frequency
0014 R 8bit x1 Phase order
Bit_7=1 if mains phase order is correct
Bit_3=1 if genset phase order is correct
Other bits are don’t care
0016-0017 R 32bit x256 Genset active power: this 24 bit signed register holds the
genset active power multiplied by 256. Least significant 16
bits are in the register 0016h. Most significant 8 bits are in
the LSB of the register 0017h.
0018 R 8bit x100 Power factor multiplied by 100 (signed byte). Negative
values indicate a capacitive power factor.
0024 R/ 8bit x1 Year as a BCD byte. Values are from 0 to 99h.
W
0025 R/ 8bit x1 Month as a BCD byte. Values are from 1 to 12h.
W
0026 R/ 8bit x1 Date as a BCD byte. Values are from 1 to 31h.
W
0027 R/ 8bit x1 Hours as a BCD byte. Values are from 0 to 23h.
W
0028 R/ 8bit x1 Minutes as a BCD byte. Values are from 0 to 59h.
W
0029 R/ 8bit x1 Seconds as a BCD byte. Values are from 0 to 59h.
W
002A R 16bit x0.1 Engine speed (rpm)
002B R 16bit x10 Oil pressure multiplied in bars.
002C R 16bit x1 Coolant temperature in degrees C.
002D R 16bit x1 Fuel level as %
002F R 16bit x10 Battery voltage
0030 R 8bit x50 Charge input voltage
-5-
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)
-6-
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)
-7-
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)
-8-
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)
-9-
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)
- 10 -
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)
- 11 -
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)
- 12 -