Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
Agenda
Overview
Modbus ASCII/RTU
Frame Structure
Exception codes
Function codes
Coils
Holding registers
Drive parameters
RS-485
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
Overview
MODBUS Protocol is a messaging structure created by MODICON
company to connect PLC to programming tools.
It is now widely used to establish master-slave communication between
intelligent devices.
MODBUS is independent of the physical layer.
It can be implemented using RS232, RS422, or RS485 or over a variety
of media (e.g. fibre, radio, cellular, etc...).
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
Modbus+/HDLC
Master/Slave
Ethernet II
802.3
Other
RS-485
RS-485/RS-232
Ethernet
physical layer
Modbus +
Modbus RTU
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
Modbus RTU:
silence
Address
Function
Data
Checksum
silence
Modbus ASCII:
Start
Address
Function
Data
3A hex
CR
0D hex
2009-June-22
Flemming Huusmann DD-SMPM
Checksum
LF
0A hex
Drives Division
Confidential / Property of Danfoss Drives A/S
Address field
Address
Function
Data
Checksum
Valid slave device addresses are in the range of 0 ... 247 decimal.
The individual slave devices are assigned addresses in the range of 1 ... 247.
Value 0 is reserved for broadcast messages (no response).
Request:
A master addresses a slave by placing the slave address in the address field of
the message.
Response:
When the slave sends its response, it places its own address in this address field
of the response to let the master know which slave is responding.
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
Function Field
Address
Function
Data
Checksum
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
Data Field
Address
Function
Data
Checksum
Request:
The data field contains additional information which the slave must use to take the action
defined by the function code. This can include items like register addresses, quantity of
items to be handled, etc...
Response:
If no error occurs, the data field contains the data requested.
If an error occurs, the field contains an exception code that the master application can use
to determine the next action to be taken.
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
0x00
0x01
0x02
0x03
0x04
0x05
0x06
Only reset
0x07
Not changeable
0xB
No write access
0x11
Data change in the parameter called is not possible in the present mode
0x12
Other error
0x40
0x41
0x42
0x43
0x82
0x83
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
10
Checksum Field
Address
Function
Data
Checksum
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
11
Request :
1 byte
1 byte
2 bytes
2 bytes
2 bytes
Slave
Address
Function
code=0x03
First word
address
Number of
words to read
CRC16
Response :
1 byte
1 byte
2 bytes
2 bytes
2 bytes
2 bytes
Slave
Address
Function
code=0x03
Number of
bytes read
Value of the
first word
Value of the
last word
CRC16
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
12
Request :
1 byte
1 byte
2 bytes
2 bytes
2 bytes
Slave
Address
Function
code=0x06
Word
address
Value of word
CRC16
Response :
1 byte
1 byte
2 bytes
2 bytes
2 bytes
Slave
Address
Function
code=0x06
Word address
Value of word
CRC16
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
13
Request :
1 byte
1 byte
2 bytes
2 bytes
Slave
Address
Function
code=0x10
First word
address
Number of
words to write
1 byte
Number of
bytes
2 bytes
Value of the
first word
2 bytes
CRC16
Response :
1 byte
1 byte
2 bytes
Slave
Address
Function
code=0x10
First word
address
2 bytes
Number of
words to write
2 bytes
CRC16
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
14
Function
code
Read coils
1 hex
3 hex
5 hex
6 hex
Diagnostics*
8 hex
F hex
10 hex
B hex
11 hex
2B hex
*=
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
15
Function
Diagnostics
Function
code
Sub-function code
Sub-function
Restart communication
10 (0xA)
11 (0xB)
12 (0xC)
13 (0xD)
14 (0xE)
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
16
Function
Function
code
Diagnostics
Sub-function code
Sub-function
Return diagnostic register
Response:
MSB
LSB
Description
Length
Data
Function code
1 byte
0x08
Sub-function code
2 bytes
0x0002
4 bytes
Alarm word
4 bytes
Warning word
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
17
Function
Function
code
Diagnostics
Sub-function code
11
Sub-function
Return Bus Message Count
Response:
MSB
LSB
Description
Length
Data
Function code
1 byte
0x08
Sub-function code
2 bytes
0x000B
Data
2 bytes
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
18
Function
Function
code
Diagnostics
Sub-function code
12
Sub-function
Return bus communication error count
Response:
MSB
LSB
Description
Length
Data
Function code
1 byte
0x08
Sub-function code
2 bytes
0x000C
Data
2 bytes
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
19
Function
Function
code
Diagnostics
Sub-function code
13
Sub-function
Return slave message count
Response:
MSB
LSB
Description
Length
Data
Function code
1 byte
0x08
Sub-function code
2 bytes
0x000D
Data
2 bytes
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
20
Function
Function
code
Diagnostics
Sub-function code
14
Sub-function
Return slave message count
Response:
MSB
LSB
Description
Length
Data
Function code
1 byte
0x08
Sub-function code
2 bytes
0x000E
Data
2 bytes
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
21
MSB
LSB
Function
Length
Data
Function code
1 byte
0x11
FC
Parameter
Name
Byte count
1 byte
1-251(N)
15-40
FC Type
Slave ID
0-250 bytes
Slave ID
15-41
Power section
1 bytes
0x00 or 0xFF
15-42
Voltage
15-43
SW version
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
22
Description
Length
Data
Function code
1 byte
0x2B
MEI type
1 byte
0x0E
1 byte
1 or 2 or 3 or 4
Conformity level
1 byte
1 or 2 or 3 or 81 or 82
More Follows
1 byte
0x00 or 0xFF
Next Object ID
1 byte
Object ID number
Number of objects
1 byte
0x00 0x0F
1st object ID
1 byte
1 byte
Device Ident.
...
LSB
...
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
23
Device Identification
FC Parameter
Name
Modbus Obj. ID
15-51
FC Serial
0x80
Private object
15-60 [0]
Option: Slot A
0x81
Private object
15-61 [0]
0x82
Private object
15-62 [0]
0x83
Private object
15-60 [1]
Option: Slot B
0x84
Private object
15-61 [1]
0x85
Private object
15-62 [1]
0x86
Private object
15-60 [2]
Option: Slot C0
0x87
Private object
15-61 [2]
0x88
Private object
15-62 [2]
0x89
Private object
15-60 [3]
Option: Slot C1
0x8A
Private object
15-61 [3]
0x8B
Private object
15-62 [3]
0x8C
Private object
15-45
Option: Slot D
0x8D
Private object
2009-June-22
Flemming Huusmann DD-SMPM
Modbus description
Drives Division
Confidential / Property of Danfoss Drives A/S
24
Description
Signal direction
1 16
17 32
33 48
49 64
65
66 - 65536
0=
1=
Reserved
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
25
Description
00001 00006
Reserved
00007
00008
Reserved
00009
Parameter index*
00010 00999
01000 01999
02000 02999
03000 03999
04000 04999
49000 49999
50000
50010
50200
50210
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
26
Drives Division
Confidential / Property of Danfoss Drives A/S
27
Parameter no.
Parameter name
Setting
8-30
Protocol
Modbus RTU
8-31
Address
1 247
8-32
Baud rate
2400 - 115200
8-33
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
28
RS-485 physics
5V
Master
650
650
D1
120
1 nF
120
1 nF
D0
Common
Slave 2
Slave 1
32 (31 slaves)
Bus polarisation
Line terminator
Common polarity
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
29
Modbus TCP
MCA 122
Modbus TCP is the oldest Industrial Ethernet
Protocol
Was introduced by Modicon back in 1999.
The Protocol is widely used inside:
Water/Wastewater and inside companies
standardizing their PLC system on
Modicon/Group Schneider PLCs
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
30
Modbus TCP
MCA 122
Modbus RTU to Modbus TCP
Easy connection to Group Schneider PLCs and leading
SCADA systems
High performance option, capable of execute
commands in 5mSec rate
Two Ethernet ports with build in switch, enabling line
structure.
No need for expensive switches, due to the build in
switch,
Build in web server, for easy status from remote PC
E-mail notify, that can send E-mail if Warning/alarm
occurs
Register mapping equal to Modbus RTU, which allows a
easy upgrade from
High speed access from MCT-10 Setup Software via
Ethernet
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
31
Modbus RTU/TCP
Request :
1 byte
1 byte
2 bytes
2 bytes
2 bytes
Slave
Address
Function
code=0x03
First word
address
Number of
words to read
CRC16
Request :
1 byte
1 byte
2 bytes
2 bytes
Slave
Address
Function
code=0x10
First word
address
Number of
words to write
1 byte
Number of
bytes
2 bytes
2 bytes
Value of the
first word
CRC16
This is only possible with consecutive registers (no holes in the range)
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
32
Modbus RTU/TCP
Register #
10
11
12
13
14
15
16
17
18
19
20
21
2009-June-22
Flemming Huusmann DD-SMPM
Data
Par. 0-01
Par. 0-02
Drives Division
Confidential / Property of Danfoss Drives A/S
33
Modbus RTU/TCP
WRITE
Data
2810
CTW
12-21[0]
8-43[0]
2811
REF
12-21[1]
8-43[1]
2812
PCD 3
12-21[2]
8-43[2]
2813
PCD 4
12-21[3]
8-43[3]
2814
PCD 5
12-21[4]
8-43[4]
2815
PCD 6
12-21[5]
8-43[5]
2816
PCD 7
12-21[6]
8-43[6]
2817
PCD 8
12-21[7]
8-43[7]
2818
PCD 9
12-21[8]
8-43[8]
2719
PCD 10
12-21[9]
8-43[9]
2910
STW
21-22[0]
8-44[0]
2911
MAV
21-22[1]
8-44[1]
2912
PCD 3
21-22[2]
8-44[2]
2913
PCD 4
21-22[3]
8-44[3]
2914
PCD 5
21-22[4]
8-44[4]
2915
PCD 6
21-22[5]
8-44[5]
2916
PCD 7
21-22[6]
8-44[6]
2917
PCD 8
21-22[7]
8-44[7]
2918
PCD 9
21-22[8]
8-44[8]
2919
PCD 10
21-22[9]
8-44[9]
2009-June-22
Flemming Huusmann DD-SMPM
Modbus TCP
Modbus RTU
Mapping parameter
Register #
Drives Division
Confidential / Property of Danfoss Drives A/S
34
Modbus RTU/TCP
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
35
Modbus
www.modbus.org
2009-June-22
Flemming Huusmann DD-SMPM
Drives Division
Confidential / Property of Danfoss Drives A/S
36