Modbus AppNote Using ControlLogix
Modbus AppNote Using ControlLogix
Application Note
Using ControlLogix
With Equusteks DL products.
About this application Note
This application note describes how to configure and use our Modbus device (Equusteks DL products)
with the ControlLogix on the DH+ network.
The information contained in this application note is supplementary information specific to Modbus not
contained in the regular User's Guide.
Application note.
The application notes generally assume that a ControlLogix or other DH+ device which can originate
commands to Modbus via a DL product in master mode, or responding to Modbus commands via a DL
product in slave mode. Only devices capable of transmitting DH+ message commands in PLC5 (or PLC3)
format and able to receive DH+ message commands in PLC5 format can be used with the DL products on
the DH+ network, including SLCs, MicroLogixs, ControlLogixs and HMIs as well as other intelligent
devices.
Due to differences between DH+ and Modbus protocols and the universal design of the DL product there
are differences between the lengths of messages, error handling and addressing which have to be carefully
considered by the Systems Designer, Programmer and Installer.
CAUTION:
Incorrect configuration may result in unsafe operation, damage to equipment or safety hazard to
personnel. Read the DL3500 User's Guide and the appropriate application notes carefully before putting
your equusteks product on-line.
The hardware and software must be fully tested off-line in a safe TEST environment prior to putting the
unit on-line in an operational environment.
NOTES:
1. The unit that you have received can be configured as Modbus Master or Modbus Slave.
Ensure that you understand and carefully follow the specific configuration procedures for the Modbus protocol.
2. There are significant differences between the configuration, programming and operational requirements
of the Modbus Master and Modbus Slave protocols.
3. If you configure the DL3500 for Modbus Master Operation it must be the only master on the Modbus network.
A station on DH+ originates commands to the DL3500-DH+ Modbus Master that then re-transmits them
over Modbus to a Modbus Slave device. Other intelligent DH+ devices capable of initiating DH+ messages
in PLC5 (or PLC3) format and able to receive PLC5 message commands could also be used as the DH+
master.
4. Be sure to fully test the hardware and software off-line to ensure that you understand its configuration
and operation. Prior to putting the DL3500 on-line in an production process, the operation of the complete
system should be fully tested on-line in a safe "test" environment.
5. Due to differences between DH+ and Modbus hardware and software, there are differences
between the lengths of messages, error handling and addressing which have to be carefully considered by the
Systems Designer, Programmer and Installer.
6. Additional literature regarding DH+, Modbus and PLC products can be obtained from Modicon and A-B.
Suggested reference materials for A-B DH+ protocol is shown in section 1.7 of the User's Guide.
Contact Technical Support if you need further information or assistance.
TECHNICAL SUPPORT
Tel : (604) 266-8547
Or E-Mail: [email protected]
The following table provides a reference between the different radixes used for your reference
DECIMAL TO OCTAL TO HEXADECIMAL ADDRESS CONVERSION TABLE
DEC
OCT
HEX
DEC
OCT HEX
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
00
01
02
03
04
05
06
07
10
11
12
13
14
15
16
17
00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
20
21
22
23
24
25
26
27
30
31
32
33
34
35
36
37
10
11
12
13
14
15
16
17
18
19
1A
1B
1C
1D
1E
1F
DEC OCT
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
40
41
42
43
44
45
46
47
50
51
52
53
54
55
56
57
HEX
DEC
20
21
22
23
24
25
26
27
28
29
2A
2B
2C
2D
2E
2F
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
OCT HEX
60
61
62
63
64
65
66
67
70
71
72
73
74
75
76
77
30
31
32
33
34
35
36
37
38
39
3A
3B
3C
3D
3E
3F
Note:
YY
0
1
4
3
1
3
0
4
01-99
01-99
01-99
01-99
01-99
01-99
01-99
01-99
1-999
1-999
1-999
1-999
1-999
1-999
1-999
1-999
Modbus
Description
Modbus
Command
01
02
03
04
05
06
15
16
Leading zeros in the Destination Data Table Address can be left out.
Register/Coil
Reference
0X
1X
4X
3X
0X
4X
0X
4X
Use this format if the ControlLogix, SLC, PLC, or other device allows up to 999:999 to be entered for the file
and word. For this particular format, your starting register address should be less than 1000 (1 to 999).
The file goes up to 999 and the word up to 999.
X Registers or Coils
0 = 0X, 1 = 1X, 3 = 3X, 4 = 4X
YY Slave address
1 to 99
Z Register address
1 to 999
Example 1:
SYSTEM CONFIGURATION - Local ControlLogix chassis consists of a 1756-L63 in slot 0 and a 1756-DHRIO
in slot 2. Channel A (node 4) of the DHRIO module is connected to a DH+ network. A DL3500 (node 15) is also
on the network.
ROUTING TABLE - A routing table is necessary in this example because the 1756-DHRIO module will be used in
the Message Communication path to the DL3500. To set up the routing table, the RSLinx software is needed. Set up
the necessary link numbers for the backplane of the ControlLogix chassis as well as Channel A of the DHRIO
module. For this example: configure the chassis backplane to be "link 0" and Channel A to be "link 0" (0=default).
THE MESSAGE INSTRUCTION - Under the 'Configuration Tab' in the Message setup screen, the 'Message
Type' is "PLC5 Typed Write", the 'Source Element' is a tag called "DL3500" (your tag in the ControlLogix), the
'Number of Elements' is "15", and the 'Destination Tag' is "N401:950".
The 'Source Element' is a Controller scoped tag of data type integer.
Under the 'Communication Tab' in the Message setup screen, the communication 'Path' to the DL3500 is specified.
First, the location of the 1756-DHRIO module is specified by the way of the path "1,2" which stands for connection
to the back plane (the number 1) and the connection to slot 2 where the DHRIO module is. Select "DH+" as the
'Communication Method' and use the link numbers configured in the DHRIO module routing table to make the
connection to the DL3500. For this example, 'Channel' is "A", 'Source Link' is the backplane (link "0"), 'Destination
Link' is the DH+ network on Channel A (link "0"), and 'Destination Node' is the DL3500 (node "15").
Now you should map tags, use the Logic > Map PLC/SLC Messages command from the menu. The dialog has 2
frames; the upper frame is for PLC 3,5/SLC Mapping. Mapping is simple put in a file number, then select a tag to
map to that file number.
Restrictions:
The tag must be in controller scope.
The tag can not be of types AXIS, Motion_Group, Message or User Defined DataType.
Example 2:
.
To configure everything follow the same step as example 1 below, make sure to map the register 303 to DL3500.
Example 3:
To configure everything follow the same step as example 1 below, make sure to map the register 003 to DL3500.
Your starting register address should be less than 1000 (1 to 999).
Notes:
1.
2.
Z:Z
0
1
4
3
1
3
0
4
1-9
1-9
1-9
1-9
1-9
1-9
1-9
1-9
0-9 : 0-999
0-9 : 0-999
0-9 : 0-999
0-9 : 0-999
0-9 : 0-999
0-9 : 0-999
0-9 : 0-999
0-9 : 0-999
Modbus
Command
01
02
03
04
05
06
15
16
Modbus
Description
Register/Coil
Reference
0X
1X
4X
3X
0X
4X
0X
4X
Leading zeros in the Destination Data Table Address can be left out.
Register/Coil Address
Z before the colon : Thousands digit
Z after the colon : Ones to Hundreds digits
Use this format if the ControlLogix or other devices allows up to 999:999 to be entered for the file and word.
The file goes up to 999 and the word up to 999. For this format, your register address should be between (1
to 9999).
X Registers or Coils
0 = 0X, 1 = 1X, 3 = 3X, 4 = 4X
Y Slave address
1 to 9
Z:Z Register address
Z before the colon : Thousands digit
0 to 9
Z after the colon : Ones to Hundreds digits
0 to 999
Example 1:
N413:36 will access register 43036 from Modbus Slave address 1.
N413:36 X = 4 (4X references), Y = 1 (Slave address), Z:Z = 3:36 (Register address)
NOTE: Z:Z cannot equal 0:0. The minimum value for Z:Z is 0:1.
This is an example of message command you may write using your ControlLogix with the format NXYZ:Z
Your starting register address for this example is 3036. Your size in element is 15.
To configure everything follow the same step as example 1 (Format NXYY:Z) below, make sure to map the register
413 to DL3500. The maximum of slave address you can have here is 9.
Example 2:
Message
Type
Read
Read
Read
Read
Write
Write
Write
Write
Notes:
1.
2.
3.
4.
Z:Z
0-2
0-2
0-2
0-2
0-2
0-2
0-2
0-2
0
1
4
3
1
3
0
4
0-9 : 0-255
0-9 : 0-255
0-9 : 0-255
0-9 : 0-255
0-9 : 0-255
0-9 : 0-255
0-9 : 0-255
0-9 : 0-255
Modbus
Description
Modbus
Command
01
02
03
04
05
06
15
16
Register/Coil
Reference
0X
1X
4X
3X
0X
4X
0X
4X
Leading zeros in the Destination Data Table Address can be left out.
Register/Coil Address
Z before the colon : Thousands digit
Z after the colon : Ones to Hundreds digits
Register and coil addresses range from 1-255, 1000-1255, 2000-2255, etc.
Slave Address
0 = slave address 1, 1 = slave address 2, 2 = slave address 3
Slave address 3 cannot access registers or coils above 5255.
Use this format if the SLC, PLC, or other device allows up to 255:255 to be entered for the file:word.
Slave address
0 = slave address 1, 1 = slave address 2, 2 = slave address 3
Registers or Coils
0 = 0X, 1 = 1X,
NOTES:
Z:Z
1.
2.
3 = 3X,
4 = 4X
Register address
Z before the colon : Thousands digit
0 to 9
Z after the colon : Ones to Hundreds digits
0 to 255
Z:Z cannot equal 0:0. The minimum value for Z:Z is 0:1.
Slave address 3 cannot access registers or coils above 5255.
Example 1:
N043:36 Y = 0 (Slave address 1), X = 4 (4X references), Z:Z = 3:36 (Register address)
NOTE:
Z:Z cannot equal 0:0. The minimum value for Z:Z is 0:1.
This is an example of message command (PLC5 Typed Write) you may write using your ControlLogix with the
format NYXZ:Z. Your starting register address for this example is 3036. Your size in element is 15.
You should make sure to map the register 043 to DL3500.
Example 2:
N203:36 Y = 2 (Slave address 3), X = 0 (0X references), Z:Z = 3:36 (Register address)
This is an example of message command you may write using your SLC5/04 with the format NYXZ:Z
Your starting register address for this example is 3036. Your size in element is 15.
You should make sure to map the register 203 to DL3500.
Example 3:
N243:36 Y = 2 (Slave address 3), X = 4 (4X references), Z:Z = 3:36 (Register address)
This is an example of message command (PLC5 Typed Write) you may write using your ControlLogix with the
format NYXZ:Z. Your starting register address for this example is 3036.
You should make sure to map the register 243 to DL3500.
yyy
ZZZZ
0
0
9
1
9
9
9
9
9
9
9
9
9
9
9
9
1-255
1-255
1-255
1-255
1-255
1-255
1-255
1-255
1-255
1-255
1-255
1-255
1-255
1-255
1-255
1-255
Data
Data
2
Char (Dec)
4
10
11
12
13
14
15
16
17
18
19
20
Modbus
Modbus
Command
Diagnostic
Sub-function
08
08
08
08
08
08
08
08
08
08
08
08
08
08
08
08
00
01
02
03
04
10
11
12
13
14
15
16
17
18
19
20
Description
xy:z
Where x = File Type
Data and Control Commands
Message
Type
y = File Number
Word
Number
(Register)
z = Word Number
Modbus
Command
Modbus
Description
Register/Coil
Reference
z
Read
Read
Read
Read
Write
Write
Write
Write
Write
Note:
Example 1:
B
F
N
S
F
S
B
N
F, S, B, N
1-255
1-255
1-255
1-255
1-255
1-255
1-255
1-255
0
1-9999
1-9999
1-9999
1-9999
1-9999
1-9999
1-9999
1-9999
1-9999
01
02
03
04
05
06
15
16
5, 6, 15, 16
0X
1X
4X
3X
0X
4X
0X
4X
0X and 4X
For Modbus command 05, set the first word of data in the PLC data table to FF00 (hex) to turn the
coil ON and 0000 to turn the coil OFF.
B18:30 (xy:z) will access register 00030 from Modbus Slave address 18.
To configure everything follow the same step as example 1 (Format NXYY:Z) below, and map the register 18 to
DL3500.
Example 2:
N200:430 (xy:z) will access register 40430 from Modbus Slave address 200.
N200:430 x = N (File Type), y = 200 (Slave address 200), z = 430 (Register address).
Your starting register address for this example is 430.
To configure everything follow the same step as example 1 (Format NXYY:Z), and map the register 200 to
DL3500.
Example 3:
N240:999 (xy:z) will access register 40999 from Modbus Slave address 240.
N240:999 x = N (File Type), y = 240 (Slave address 200), z = 999 (Register address).
Your starting register address for this example is 999.
To configure everything follow the same step as example 1 (Format NXYY:Z), and map the register 240 to
DL3500.
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D
00
00
09
01
09
09
09
09
09
09
09
09
09
09
09
09
Data Value
0 255
02
Char (Dec)
04
10
11
12
13
14
15
16
17
18
19
20
Modbus
Modbus
Command
Diagnostic
Sub-function
08
08
08
08
08
08
08
08
08
08
08
08
08
08
08
08
00
01
02
03
04
10
11
12
13
14
15
16
17
18
19
20
Description
Modbus
Command Code
01
02
03
04
05
06
16
05,06,16
Modbus
Modbus
Command Description
Address
Read Coil Status
00001 - 09999
Read Input Status
10001 - 19999
Read Holding Register
40001 - 49999
Read Input Register
30001 - 39999
Force Single Coil
00001 - 09999
Pre-set Single Holding Register 40001 - 49999
Pre-set Multiple Holding Registers 40001 - 49999
Broadcast Command.
2.2
BROADCAST COMMAND
Modbus protocol uses the Broadcast command (i.e. commands 05, 06 and 16 with a station address of 00) to write to
all slave devices on a Modbus network simultaneously, no response is expected by the Master. Allen-Bradley DH+
protocol does not support Broadcast. A-B SLCs are not capable of responding to a single "Broadcast" command
over the DH+ network.
DL3500s can be configured to ignore or to execute Broadcasts. Broadcasting is
accomplished by splitting the command into separate messages for retransmission one at a time to each DH+ station
within pre-configured range of stations. Because of the time taken to send out multiple messages over the DH+,
Broadcasts commands are normally restricted to an absolute minimum range of DH+ stations.
A SLC or other device at DH+ station address 00 cannot be addressed by Modbus read or write commands as 00 is
normally the Broadcast command. DH+ station 00 may be used as the DH+ station address for the DL3500.
NOTES:
1. Restrict the DH+ stations receiving a Modbus broadcast to prevent writing to unintended DH+ destinations.
2. Valid Modbus Slave addresses of stations on DH+ are 1 to 77 octal (i.e. Slave station addresses 1 to 63 dec.).
2.3
COMMUNICATIONS SEQUENCE
The DL3500 module receives a Modbus query on its asynchronous serial port, converts it into the appropriate DH+
message and sends it out on the DH+ network. The DH+ response is received, converted into the corresponding
Modbus response and sent back to the Modbus Master. Modbus protocol does not allow messages to be buffered so
the DL3500 processes one message at a time. The DL3500 unit will respond to the Modbus interface with the
appropriate Modbus exception codes in the event of detectable errors.
2.4
ERROR GENERAL
CODE DESCRIPTION
1
2
Illegal Function
Illegal Data Address
2.5
The following shows the maximum number of coils/registers that can be sent or received in a single Modbus
message. The limits are because of the different structure of Modbus and A-B DH+ protocols, and also due to the
internal memory structure of the DL3500. These values have only a limited relationship to the Modbus/DH+
address mapping ranges configured in the DL3500.
The max. number of coils that can be read in a single transaction is 1600. (Normal Modbus allows 2000)
The max. number of registers that can be read in a single transaction is 100. (Normal Modbus allows 125)
The max. number of registers that can be written in a single transaction is 100. (Normal Modbus allows 100)
CAUTIONS:
1. Ensure that your communications program design prevents self-optimising Modbus Master communications
programs (in some MMIs and Operator Interfaces) from requesting data in packets larger than the above limits.
2. Ensure that the Modbus program does not generate Modbus commands with addresses that can bridge across
more than one of the address range entries configured in the DL3500.
3. Any of the above conditions could cause indeterminate errors.
2.6
The DL3500 unit is transparent to valid Modbus commands addressed to station numbers corresponding to active
stations on DH+. The DL3500 will only accept commands to DH+ station addresses 1 to 63 decimal. Modbus
commands using address 0 are broadcast commands and are handled differently by the DL3500.
After formatting and converting the Modbus message to DH+ protocol the command is sent out to the addressed
DH+ (slave) device. If the station is inactive the query is disregarded. Each addressed slave station must be a
unique address on Modbus and on the DH+ network (i.e. do not duplicate an address used on the Modbus network
with a station address on the DH+). If duplicate addresses exist then the situation will arise where two or more
stations could accept the query resulting in multiple responses which would cause communications errors and
perhaps writing to unintended destinations.
NOTE:
Special consideration should be given to the Modbus and DH+ addressing to avoid duplication of network
addresses. Confusion could arise because A-B uses an "octal" addressing scheme for DH+ network
stations and Modbus uses "decimal". Ensure use of a common numbering scheme (see section 1.6 for
cross-references).
2.7
The relationship between Modicon Modbus and Allen-Bradley PLC addresses is programmed by the user and is
stored in the DL3500's EEPROM. The DL3500 can be programmed for eight different address ranges. Each
Modicon address range that you wish to set-up may be mapped to a unique A-B address range. The length of the AB field required is the same as that defined by the Modicon address range. All A-B files should be either Binary,
Integer or Floating Point files. These A-B files must be created by the A-B PLC programmer to the full length
required by the Modbus Address Translation and Mapping parameters specified. No logic is needed in the A-B PLC
to respond to commands received from the Modbus network. To define how a range of Modicon addresses maps
over to Allen-Bradley addresses, the user must enter the following configuration information:
In the configuration software the type of PLC used is selected. See below.
Modbus Parameters-DL32
V3.1
Specifies the starting address of a range of Modbus addresses that will be mapped to
A-B. Valid entries are 00000 to 09999, 10000 to 19999, 30001 to 39999 and 40001 to
49999.
Modicon End Address: Specifies the end address of a range of Modbus addresses that will be converted to A-B.
The range of entries is shown above.
A-B Starting Address:
Specifies the A-B PLC starting file number for the Modbus data. Valid entries are
001:000 to 999 : 999 (Sometimes files less than 8 are reserved) (ensure that data length
does not exceed file boundary). NOTE: N7 and B3 are valid files!!
Floating Point Checkbox: Used to Specify if the data is Modbus Floating point and to be written into Floating Point
Files
Coils/discretes:
The bit address range of an A-B Binary file is 1000 words or 16,000 bits (i.e. 0 - 15,999 decimal). This
means that one A-B file is more than sufficient to hold the largest Modbus coil address possible.
An A-B binary file/bit address starts at bit 0 and the first legal Modbus coil address starts at 1, which
means that normally the first Modbus coil address 00001 (or 10001) will correspond to bit 0 in A-B word 0.
If a Modbus address of 00000 (or 10000) is entered in the Starting Address field it causes the first (legal)
Modbus coil addresses i.e. bit 1 to correspond to an A-B file/word bit 1. This technique makes it easy to
compare and match the Modbus and A-B memory maps, and easier to bit search the A-B program.
When a Modbus coil /bit address is defined in the Start Address field i.e. 0XXXX or 1XXXX), then the
first A-B Starting Address that can be used is Binary file 3 word 000 (B3:0).
Registers/words:
The word address range of an A-B Integer file is 0 - 999 i.e., only 1000 words (registers). Therefore if a
Modbus address range greater than 1000 registers is required, it is necessary to use more than one A-B
Integer (N) file, which will require multiple configuration parameter entries. The first A-B address that can
be used for 3xxxx and 4xxxx register/word transfers is an A-B Integer file at file/word address N7:0.
Address Ranges:
The Modicon Address Range (i.e., Start Address less End Address), and the A-B Start Address
selected, must not overflow the maximum A-B file address limit. This means that if A-B Starting
Address of word 250 is used then the maximum register range for mapping must be 1000 minus
250, i.e. 750.
2.7.2
Integer Files
Now make sure you map every A-B starting Address with a tag in your ControlLogix. For this
example we should have:
If you want to know how to configure your ControlLogix, just follow example 1 shown in
40001
30011
40010
30070
007:001
012:011
Note: (*)
This technique makes it easy to compare and match the Modbus and A-B memory maps, and easier to
bit search the A-B program.
Example 3
Binary Files
Mapping Modicon coils 00001 to 00010 to A-B file B3/48 (binary file B3, bit 48) to B3/57
Mapping Modicon coil 00020 to A-B file B3/98
Mapping Modicon coils 10031 to 10040 to A-B file B3/32 to B3/41
Modicon Start
xxxxx
00001
00018
10031
NOTE:
00010
00020
10040
003:003
003:006
003:002
NOTE
When mapping a Modicon coil to an A-B PLC bit that does not start at bit 0 of a word, an
offset to bit 0 must be added.
Example 4
Binary Files
Mapping Modicon coils 00001 to 00010 to A-B file B3/16 (binary file B3, bit 16) to B3/25
Mapping Modicon coil 00020 to A-B file B3/320
Mapping Modicon coils 10031 to 10040 to A-B file B3/496 to B3/505
Modicon Start
xxxxx
00001
00018
10031
Example 5
00010
00020
10040
003:001
003:020
003:031
Floating Point
008:000
008:005
;
;
NOTE:
A-B Floating Point (F) values are 32 bits in length and require two Modbus registers for each
floating point value.
NOTES:
1. The (Binary File) and (Integer File) text after the A-B File:Word address does not appear on the
configuration screen and is provided here for reference only.
2. The A-B file corresponding to Modbus Coil addresses should have been previously configured
in the PLC as a Binary (B) file and its size configured for the largest coil address.
3. The A-B file corresponding to Modbus Register addresses should have been previously configured
in the PLC as an Integer (N) file and its size configured for the largest register address.
2.7.2
Modbus protocol generally permits a maximum of about 125 registers or 2000 coils to be read in a single transaction
(the maximum number is dependent on the Modbus driver). When specifying multiple address translation ranges
within the same type of Modbus address (either Oxxxx, 1xxxx, 3xxxx or 4xxxx) it is essential to establish a buffer
region of at least 125 registers or 2000 coils between each address types range. Failure to do this may allow a selfoptimising MMI interface program to write (or read) data to/from two different areas of the Allen-Bradley PLC with
undesired and indeterminate results.
The examples above define a similar A-B word address to the Modbus start address which allows easier comparison
between the Modbus A-B addresses used. For example a Modbus start address of 40001 can be represented in A-B
PLC-5 file format by using A-B integer file N 40:001. Address mapping using this technique is recommended for a
users convenience only, as it provides a very useful method for record-keeping, cross-reference and recognition.
This technique is not mandatory and any Modbus address can be written to any A-B file.
When considering use of the above technique note that the first available open A-B file address for a PLC-5
controller is file 7. Modbus address 0xxxx cannot be displayed similarly in A-B format as A-B output file 0 should
not be used. In this case for easy recognition use an A-B Binary file for Modbus output coils such as 9, 99, 999 or
any other convenient file number is easily recognizable.
DL4000 firmware permits the entry of 00000 and 10000 values in the Modicon Start Address field even though
strictly speaking these are not legal Modbus addresses. This feature allows a programmer to align an A-B Binary file
bit 1 with the first legal Modbus Bit / Coil address 1. For example mapping Modicon Start Address 00000 to A-B
Start Address (B) 003:000, or Modicon Start Address 10000 to A-B Start Address (B) 010:000 aligns Modbus bit 1
with A-B bit 1. The "B" for Binary file is implied but not displayed.
NOTES:
1. Enough space must have been configured and be available in the A-B file to contain the full
range of Modbus addresses specified or it will cause over-writing existing A-B files and data.
2. Do not transmit Modbus messages to the DL4000 to read or write more than 1600 coils or
100 registers in a single Modbus read or write command.
3. Ensure that all A-B addresses specified have been created in the destination PLC.
4. Set all unused Modbus to A-B addresses to zero.