DKG-309 / 319 / 507-J / 517-J / 527 / 537 DKG-543 / 547 / 553 / 557 Modbus Application Manual

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.

2007)

Tel: +90-216-466 84 60
Fax: +90-216 364 65 65
[email protected]
http://www.datakom.com.tr

DKG-309 / 319 / 507-J / 517-J / 527 / 537


DKG-543 / 547 / 553 / 557
MODBUS APPLICATION MANUAL

-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 connection to the MODBUS master may be done in 3 ways:

1) RS232 connection using directly the RS232 port provided.


2) RS422/485 connection using external RS422/485 converter.
3) Modem connection using external modem.

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.

The MODBUS properties of the unit are:


-Data transfer mode: RTU
-Serial data: 9600 bps, 8 bit data, no parity, 1 bit stop
-Supported functions:
-Function 3 (Read multiple registers)
-Function 6 (Write single register)
-The answer to an incoming message is sent with a minimum of 4.3ms delay after message
reception.

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:

Byte Description Value


0 Controller address 1 to 144
1 Function code 3
2 Starting address high See below the description of available registers
3 Starting address low
4 Number of registers high always 0
5 Number of registers low max 10h (16 decimal)
6 CRC low byte See below for the checksum calculation
7 CRC high byte

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)

The normal response will be:


Byte Description Value
0 Controller address same as in the query
1 Function code 3
2 Data lenght in bytes (L) number of registers * 2
3 High byte of 1st register
4 Low byte of 1st register
5 High byte of 2nd register
6 Low byte of 2nd register
....
L+1 High byte of the last register
L+2 Low byte of the last register
L+3 CRC low byte See below for the checksum calculation
L+4 CRC high byte

The exceptional response will be:


Byte Description Value
0 Controller address same as in the query
1 Function code 131 (function code + 128)
2 Exception code 2 (illegal address)
3 CRC low byte See below for the checksum calculation
4 CRC high byte

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:

Byte Description Value


0 Controller address 1 to 144
1 Function code 6
2 Register address high See below the description of available registers
3 Register address low
4 Data high byte
5 Data low byte
6 CRC low byte See below for the checksum calculation
7 CRC high byte

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)

The normal response will be the same as the query:


Byte Description Value
0 Controller address 1 to 144
1 Function code 6
2 Register address high See below the description of available registers
3 Register address low
4 Data high byte
5 Data low byte
6 CRC low byte See below for the checksum calculation
7 CRC high byte

The exceptional response will be:


Byte Description Value
0 Controller address same as in the query
1 Function code 134 (function code + 128)
2 Exception code 2 (illegal address)
or
10 (write protection)
3 CRC low byte See below for the checksum calculation
4 CRC high byte

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.

7) The final contents of the CRC register is the CRC value.

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)

ADDRESS R/ DATA COEFFICIENT DESCRIPTION


(hex) W SIZE
0032 R 8bit - Shutdown alarm bits
bit_0: oil pressure shutdown alarm
bit_1: high temperature shutdown alarm
bit_2: over/under speed shutdown alarm
bit_3: fail to start shutdown alarm
bit_4: ECU fail shutdown alarm
bit_5: overload load_dump alarm
bit_6: genset voltage fail shutdown alarm
bit_7: low fuel shutdown alarm
0033 R 8bit - Shutdown alarm bits
bit_0: coolant level shutdown alarm
bit_1: high battery voltage shutdown alarm
bit_2: charge fail shutdown alarm
bit_3: rectifier fail shutdown alarm
bit_4: emergency stop shutdown alarm
bit_5: spare_2 shutdown alarm
bit_6: spare_1 shutdown alarm
bit_7: -
0034 R 8bit - Warning bits
bit_0: oil pressure warning
bit_1: high temperature warning
bit_2: over/under speed warning
bit_3: fail to stop warning
bit_4: ECU fail warning
bit_5: overload warning
bit_6: genset voltage fail warning
bit_7: low fuel shutdown alarm
0035 R 8bit - Warning bits
bit_0: coolant level warning
bit_1: high battery voltage warning
bit_2: charge fail warning
bit_3: rectifier fail warning
bit_4: emergency stop warning
bit_5: spare_2 warning
bit_6: spare_1 warning
bit_7: service request
0036 R 16bit - Alarm input statuses
bit_0: low oil press. shutdown input
bit_1: high temp shutdown input
bit_2: coolant level shutdown input
bit_3: rectifier fail shutdown input
bit_4: emergency stop shutdown input
bit_5: spare_1 shutdown input
bit_6: spare_2 shutdown input
bit_7: fuel level shutdown input
bit_8: low oil press measured shutdown
bit_9: high temp measured shutdown
bit_10: over/under speed shutdown
bit_11: fail to start shutdown
bit_12: charge fail shutdown
bit_13: overload shutdown
bit_14: genset voltage fail shutdown
bit_15: high battery voltage shutdown

-6-
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)

ADDRESS R/ DATA COEFFICIENT DESCRIPTION


(hex) W SIZE
0037 R 16bit - Warning input statuses
bit_0: low oil press. warning input
bit_1: high temp warning input
bit_2: coolant level warning input
bit_3: rectifier fail warning input
bit_4: emergency stop warning input
bit_5: spare_1 warning input
bit_6: spare_2 warning input
bit_7: fuel level warning input
bit_8: low oil press measured warning
bit_9: high temp measured warning
bit_10: over/under speed warning
bit_11: fail to stop warning
bit_12: charge fail warning
bit_13: battery low warning
bit_14: -
bit_15: high battery voltage warning
0039 R 8bit - Relay output statuses
bit_0: genset contactor
bit_1: crank relay
bit_2: spare_2 (26)
bit_3: spare_1 (27)
bit_4: mains contactor
bit_5: fuel
bit_6: -
bit_7: -
003A R 16bit - Relay extension module, relay statuses
bit_0: module_1, relay_1 status
bit_1: module_1, relay_2 status
bit_2: module_1, relay_3 status
bit_3: module_1, relay_4 status
bit_4: module_1, relay_5 status
bit_5: module_1, relay_6 status
bit_6: module_1, relay_7 status
bit_7: module_1, relay_8 status
bit_8: module_2, relay_1 status
bit_9: module_2, relay_2 status
bit_10: module_2, relay_3 status
bit_11: module_2, relay_4 status
bit_12: module_2, relay_5 status
bit_13: module_2, relay_6 status
bit_14: module_2, relay_7 status
bit_15: module_2, relay_8 status

-7-
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)

ADDRESS R/ DATA COEFFICIENT DESCRIPTION


(hex) W SIZE
003B R 16bit - Relay function statuses
bit_0: fuel
bit_1: alarm
bit_2: crank
bit_3: stop
bit_4: genset contactor
bit_5: mains contactor
bit_6: choke
bit_7: preheat
bit_8: shutdown alarm
bit_9: warning
bit_10: shutdown or warning
bit_11: automatic ready
bit_12: weekly schedule On time
bit_13: exerciser on
bit_14: load dump alarm
bit_15: -
003C R 16bit - Relay function statuses
bit_0: mains fail
bit_1: block heater on
bit_2: service request
bit_3: J1939 ECU warning
bit_4: J1939 ECU alarm
bit_5: flashing relay output
bit_6: -
bit_7: fuel pump
bit_8: mains phase order fail
bit_9: gen phase order fail
bit_10: idle speed operation
bit_11: -
bit_12: -
bit_13: -
bit_14: -
bit_15: -
003D R 8bit - Operating mode
bit_0: -
bit_1: -
bit_2: -
bit_3: -
bit_4: auto mode
bit_5: off mode
bit_6: test mode
bit_7: load test mode
003E R 16bit x1 Operation timer. Different actions are taken when this
register switches from 1 to 0.
003F R 8bit - Genset operating status: (unsigned byte)
0:load on mains
1:waiting before fuel
2:waiting before/between cranks
3:cranking
4:engine heating
5:genset contactor timer
6:load on genset
7:mains contactor timer
8:cooldown operation
9:stopping
10-255:not used

-8-
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)

ADDRESS R/ DATA COEFFICIENT DESCRIPTION


(hex) W SIZE
0040 R/ 8bit - Last pressed key. This byte is also used in order to change
W operation mode through MODBUS.
bit_0: -
bit_1: -
bit_2: -
bit_3: -
bit_4: auto mode
bit_5: off mode
bit_6: test mode
bit_7: load test mode
0057- R 40bit 0.01 Engine run hours coded in 5 bytes.
0058-0059 First 2 bytes (register 0057h) contain binary flags. Last 3
bytes contain engine hours multiplied by 0.16 hours.
The number of zeros in the first 2 bytes multiplied by 0.01h
should be added to the total in order to get the correct
engine hours in 0.01h steps.
Example:
0057 = 65472d=FFC0h= 1111.1111.1100.0000b
0058 = 355d (0163h)
0059 = 02d
The number of zeros in the register 0057 is 6.
Thus the engine hours is 6x0.01 + 355x0.16 +
2x65536x0.16=21028.38 hours.
005A- R 40bit 0.01 Engine run hours since last service, coded in 5 bytes.
005B- First 2 bytes (register 005Ah) contain binary flags. Last 3
005C bytes contain engine hours multiplied by 0.16 hours.
The number of zeros in the first 2 bytes multiplied by 0.01h
should be added to the total in order to get the correct
engine hours in 0.01h steps.
Example:
005A = 65472d=FFC0h= 1111.1111.1100.0000b
005B = 355d (0163h)
005C = 02d
The number of zeros in the register 0057 is 6.
Thus the engine hours is 6x0.01 + 355x0.16 +
2x65536x0.16=21028.38 hours.
005D- R 40bit - Time since last service in minutes, coded in 5 bytes.
005E- First 2 bytes (register 005Dh) contain binary flags. Last 3
005F bytes contain time multiplied by 16 minutes.
The number of zeros in the first 2 bytes should be added to
the total in order to get the correct time since last service in
minutes.
Example:
005A = 65472d=FFC0h= 1111.1111.1100.0000b
005B = 355d (0163h)
005C = 02d
The number of zeros in the register 0057 is 6.
Thus the time is 6 + 355x16 + 2x65536x16=2102838
minutes. (1460 days)

-9-
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)

ADDRESS R/ DATA COEFFICIENT DESCRIPTION


(hex) W SIZE
0060 R 16bit x8 J1939: Engine speed
0061 R 16bit x1 J1939: Coolant temperature (-40°C offset)
0062 R 16bit x10 J1939: Oil pressure
0063-0064 R 16bit x20 J1939: Total engine hours
0065 R 16bit x100 J1939: Air filter differential pressure
0066 R 16bit x50 J1939: Boost pressure in bars
0067 R 16bit x10 J1939: Fuel pressure in bars
0068 R 16bit x1 J1939: Fuel Temperature (-40°C offset)
0069 R 16bit x10 J1939: Fuel rate (lt/hr)
006A R 16bit x1 J1939: Instantaneous fuel economy
006B R 16bit x1 J1939: Oil temperature (-40°C offset)
006C R 16bit x1 J1939: Ambient air temperature (-40°C offset)
006D R 16bit x1 J1939: Air inlet temperature (-40°C offset)
006E R 16bit x1 J1939: Intake manifold_1 temperature (-40°C offset)
006F R 16bit x1 J1939: exhaust gas temperature
0070 R 8bit x1 J1939 warning_1_FMI
0071 R 16bit x1 J1939 warning_1_SPN
0072 R 8bit x1 J1939 warning_2_FMI
0073 R 16bit x1 J1939 warning_2_SPN
0074 R 8bit x1 J1939 warning_3_FMI
0075 R 16bit x1 J1939 warning_3_SPN
0076 R 8bit x1 J1939 warning_4_FMI
0077 R 16bit x1 J1939 warning_4_SPN
0078 R 8bit x1 J1939 warning_5_FMI
0079 R 16bit x1 J1939 warning_5_SPN
007A R 8bit x1 J1939 warning_6_FMI
007B R 16bit x1 J1939 warning_6_SPN
007C R 8bit x1 J1939 warning_7_FMI
007D R 16bit x1 J1939 warning_7_SPN
007E R 8bit x1 J1939 warning_8_FMI
007F R 16bit x1 J1939 warning_8_SPN

- 10 -
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)

ADDRESS R/ DATA COEFFICIENT DESCRIPTION


(hex) W SIZE
1000 R 8bit x1 Idle timer
1001 R 8bit x0.1 Current transfer ratio
1002 R 8bit x1 Oil pressure sensor type
1003 R 8bit x1 Temperature sensor type
1004 R 8bit x1 Holdoff timer
1005 R 8bit x10 Low oil pressure shutdown limit
1006 R 8bit x10 Low oil pressure warning limit
1007 R 8bit x1 High temp shutdown limit
1008 R 8bit x1 High temp warning limit
1009 R 8bit x1 High frequency shutdown limit
100A R 8bit x1 High frequency warning limit
100B R 8bit x1 Low frequency shutdown limit
100C R 8bit x1 Low frequency warning limit
100D R 8bit x0.5 High voltage shutdown limit
100E R 8bit x0.5 Low voltage shutdown limit
100F R 8bit x0.5 Mains voltage high limit
1010 R 8bit x0.5 Mains voltage low limit
1011 R 8bit x1 Hysteresis voltage
1012 R 8bit x5 High battery voltage shutdown limit
1013 R 8bit x5 High battery voltage warning limit
1014 R 8bit x5 Low battery voltage warning limit
1015 R 16bit x1 Overcurrent load_duımp limit
1016 R 16bit x1 Excess power load_dump limit
1017 R 8bit x1 Overload timer
1018 R 8bit x1 Number of start attempts
1019 R 8bit x1 Engine heating temperature
101A R 8bit x1 Stop timer
101B R 8bit x1 Crank timer
101C R 8bit x1 Preheat timer
101D R 8bit x1 Wait between starts timer
101E R 8bit x1 Wait before fuel timer
101F R 8bit x0.5 Cooldown timer
1020 R 8bit x0.5 Mains waiting timer
1021 R 8bit x1 Genset contactor timer
1022 R 8bit x1 Mains contactor timer
1023 R 8bit x1 Engine heating timer
1024 R 8bit x1 Horn timer

- 11 -
DKG-309 / 319 / 5XX Modbus Application Manual V-21 (07.11.2007)

ADDRESS R/ DATA COEFFICIENT DESCRIPTION


(hex) W SIZE
1025 R 8bit x1 Operation mode_1 bits:
bit_0:engine heating method
bit_1:simulate mains
bit_2:charge alternator shutdown
bit_3:genset L-L voltage display
bit_4:mains L-L voltage display
bit_5:emergency backup operation
bit_6:remote start operation
bit_7:intermittent alarm output
1026 R 8bit x1 Operation mode_2 bits:
bit_0:modem connected
bit_1:exercise on load
bit_3-2:current transformer decimal point
bit_4:low fuel shutdown
bit_5:number of poles of the alternator
bit_6:sms enable
bit_7:-
1027 R 8bit x50 Engine hours between services
1028 R 8bit x1 Months between services
1029 R 8bit x1 Max running time
102A R 8bit x1 Exercise time
102B R 8bit x10 Exercise duration
102C R 8bit x1 Operation mode_3 bits:
bit_1-0: exerciser period
bit_2:J1939 enable
bit_3:-
bit_4:-
bit_5:-
bit_6:-
bit_7:-
102D R 8bit x1 J1939 engine brand/model

- 12 -

You might also like