Logix5000 Controllers Messages: Programming Manual
Logix5000 Controllers Messages: Programming Manual
Identifies information that is critical for successful application and understanding of the product.
Allen-Bradley, Rockwell Software, Rockwell Automation, and TechConnect are trademarks of Rockwell Automation, Inc.
Trademarks not belonging to Rockwell Automation are property of their respective companies.
Summary of changes
The following table contains the changes made to this revision.
Change
Topic
Table of contents
Preface
Chapter 1
Controller messages
Introduction ............................................................................................................ 9
Supported data types .............................................................................................. 9
Message queue ....................................................................................................... 10
Cache list ................................................................................................................ 11
Unconnected buffers............................................................................................ 12
Guidelines .............................................................................................................. 13
Get or set the number of unconnected buffers ................................................ 14
Get the number of unconnected buffers ................................................... 14
Set the number of unconnected buffers .................................................... 15
Convert between INTs and DINTs ................................................................. 16
Chapter 2
Manage multiple messages
Introduction .......................................................................................................... 19
Message manager logic ......................................................................................... 19
Chapter 3
Send a message to multiple
controllers
Introduction .......................................................................................................... 23
Configure the I/O configuration....................................................................... 24
Define your source and destination elements .................................................. 24
Create the MESSAGE_ CONFIGURATION data type ............................ 25
Create the configuration array ........................................................................... 26
Get the size of the local array .............................................................................. 28
Load the message properties for a controller ................................................... 28
Configure the message ......................................................................................... 29
Step to the next controller................................................................................... 29
Restart the sequence ............................................................................................. 30
Index
Preface
This manual shows how to program message (MSG) instructions to and from
Logix5000 controllers. This manual is one of a set of related manuals that show
common procedures for programming and operating Logix5000 controllers.
For a complete list of common procedures manuals, refer to the Logix5000
Controllers Common Procedures Programming Manual, publication 1756PM001.
The term Logix5000 controller refers to any controller that is based on the
Logix5000 operating system.
Preface
Additional resources
Description
Chapter 1
Controller messages
Introduction
This section describes how to transfer (send or receive) data between controllers
by executing a message (MSG) instruction. It explains cache connections and
buffers so you can correctly program the controller.
The following data types are supported when sending CIP messages.
SINT
INT
DINT
LINT
REAL
In addition, you can send a message with any structure type that is predefined,
module-defined, or user-defined.
See Convert between INTs and DINTs (on page 16) for more information on
INTs and DINTs.
For complete details on programming a message instruction, see the Logix5000
Controllers General Instruction Reference Manual, publication 1756-RM003.
Example: Execute a Message (MSG) Instruction
If count_send = 1
and count_msg.EN = 0 (MSG instruction is not enabled)
then execute a MSG instruction that sends data to another controller.
Chapter 1
Controller messages
Description
The controller scans the MSG instruction and its rung-condition-in goes true. The message passes to a throttle that
has 16 positions. If the throttle is full, the message remains enabled but is held until another controller scan.
The System-overhead time slice executes and the message is pulled from the throttle to the message queue.
If the MSG instruction
Message queue
10
The message queue holds up to 48 MSG instructions, including those that you
configure as a block-transfer read or block-transfer write. When the queue is full,
an instruction tries to enter the queue on each subsequent scan of the instruction,
as shown in the following illustration.
Controller messages
Chapter 1
Description
The controller scans the MSG instruction.
The rung-condition-in for the MSG instruction is true.
The EN bit is set.
The MSG instruction attempts to enter the queue but 16 throttle positions exist. If all 16 are filled and a
17th message is executed, the message is enabled.
The EW bit remains cleared.
&
Cache list
Uses a connection
Your option(1)
CIP
CIP with Source ID
No
DH+
Yes
CIP generic
Your option(2)
Yes
(1)
CIP data table read or write messages can be connected or unconnected. However for most applications, it is recommended you
leave CIP data table read or write messages connected.
(2)
CIP generic messages can be connected or unconnected. However for most applications, it is recommended you leave CIP generic
messages unconnected, unless you want to use the Large Connection option.
If a MSG instruction uses a connection, you have the option to leave the
connection open (cache) or close the connection when the message is done
transmitting.
If you
Then
The connection stays open after the MSG instruction is done. This
optimizes execution time. Opening a connection each time the
message executes increases execution time.
The connection closes after the MSG instruction is done. This frees up
that connection for other uses.
11
Chapter 1
Controller messages
The controller has the following limits on the number of connections that you can
cache.
If you have this software version and
firmware revision
11.x or earlier
12.x or later
Up to 32 connections.
If several messages go to the same device, the messages may be able to share a
connection.
If the MSG instructions are to
Different devices
Then
Unconnected buffers
Definition
Unconnected buffer
An allocation of memory that the controller uses to process unconnected communication. The
controller performs unconnected communication when it:
Establishes a connection with a device, including an I/O module.
Executes a MSG instruction that does not use a connection.
12
Controller messages
Term
Chapter 1
Definition
The controller can have 10 to 40 unconnected buffers.
The default number is 10.
To increase the number of unconnected buffers, execute a MSG instruction that reconfigures the
number of unconnected buffers.
Each unconnected buffer uses 1.2 KB of memory.
If all unconnected buffers are in use when an instruction leaves the message queue, an error
occurs and data does not transfer.
Guidelines
As you plan and program your MSG instructions, follow these guidelines.
Guideline
Details
A MSG instruction can access only tags that are in the Controller Tags
folder (controller scope).
If your message is to a device that uses 16-bit Logix5000 controllers execute more efficiently and use less memory when
integers, such as a PLC-5 or SLC 500
working with 32-bit integers (DINTs).
controller, and it transfers integers (not
See "Convert between INTs and DINTs (on page 16).
REALs), use a buffer of INTs in the message
and DINTs throughout the project.
Execution time is optimized when the controller does not open a
Cache the connection for those MSG
instructions that execute most frequently, up connection each time the message executes.
to the maximum number permissible for your
controller revision.
If you want to enable more than 16 MSGs at
one time, use a management strategy to
ensure some MSG instructions are not
delayed entering the queue.
13
Chapter 1
Controller messages
Type or choose
Configuration
Message Type
CIP Generic
Service Type
Custom
Service Code
Class
304
Instance
Attribute
Source Element
Enter
source_array[0]
source_array[1]
source_array[2]
17
source_array[3]
4 (Write 4 SINTs.)
Destination Element
Communication Path
14
1, slot_number_of_controller
Controller messages
Chapter 1
Type or select
Configuration
Message Type
CIP Generic
Service Type
Custom
Service Code
Class
304
Instance
Attribute
Source Element
Enter
source_array[0]
source_array[1]
source_array[2]
17
source_array[3]
source_array[4]
source_array[5]
source_array[6]
source_array[7]
8 (Write 8 SINTs.)
Destination Element
destination_array where data type = SINT[6] (Leave all the values = 0.)
Communication Path
1, slot_number_of_controller
15
Chapter 1
Controller messages
Tag Name
Type
Description
UCB_Set
MESSAGE
Source_Array
SINT[8]
In the Logix5000 controller, use the DINT data type for integers whenever
possible. Logix5000 controllers execute more efficiently and use less memory
when working with 32-bit integers (DINTs).
If your message is to a device that uses 16-bit integers, such as a PLC-5 or SLC 500
controller, and it transfers integers (not REALs), use a buffer of INTs in the
message and DINTs throughout the project. This increases the efficiency of your
project.
Read 16-bit integers
Buffer of INTs
Word 1
INT_Buffer[0]
DINT_Array[0]
Word 2
INT_Buffer[1]
DINT_Array[1]
Word 3
INT_Buffer[2]
DINT_Array[2]
Description
The Message (MSG) instruction reads 16-bit integers (INTs) from the device and stores them in a
temporary array of INTs.
A File Arith/Logical (FAL) instruction converts the INTs to DINTs for use by other instructions in your
project.
16
Controller messages
Chapter 1
Buffer of INTs
DINT_Array[0]
INT_Buffer[0]
Word 1
DINT_Array[1]
INT_Buffer[1]
Word 2
DINT_Array[2]
INT_Buffer[2]
Word 3
Description
An FAL instruction converts the DINTs from the Logix5000 controller to INTs.
The MSG instruction writes the INTs from the temporary array to the device.
Example: Read integer values from a PLC-5 controller
If Condition_1 = 1
and Msg_1.EN = 0 (MSG instruction is not enabled)
then read 3 integers from the PLC-5 controller and store them in INT_Buffer (3 INTs).
17
Chapter 1
Controller messages
18
Chapter 2
Introduction
You can use ladder logic to send groups of message (MSG) instructions in
sequence.
If more than 16 MSGs are enabled at one time, the message throttle
prevents some of the messages from entering the message queue. If this
occurs, the MSG is held until room exists on the queue for the controller to
process the MSG. On each subsequent scan of the MSG, it checks the queue
to see if room exists.
The message manager logic lets you control the number of MSGs that are enabled
at one time and enable subsequent MSGs in sequence. In this way, MSGs enter
and exit the queue in order and do not need to wait for room on the queue to
become available.
The message manager logic sends three groups of MSGs. Use as many groups as
needed to include all your MSGs.
The Msg_Group tag controls the enabling of each MSG.
19
Chapter 2
20
Chapter 2
21
Chapter 3
Introduction
Reads data
Source element
Writes data
Destination element
If you use an asterisk [*] to designate the element number of the array, the value in
number.
The Index box is available only when you use an asterisk [*] in the Source Element or Destination Element. The
instruction substitutes the value of Index for the asterisk [*].
Tip:
To copy the previous components from a sample project, take these steps.
A. On the Help menu, click Quick Start.
B. On the Quick Start window, in the left navigation pane, expand Controller Projects, and then click Open
Sample Project.
C. In the Open Project dialog box, click MSG_To_multiple_Controllers.acd, and click Open.
23
Chapter 3
An array stores the data that is read from or written to each remote controller.
Each element in the array corresponds to another remote controller.
1. Use the following worksheet to organize the tag names in the local and
remote controllers.
Name of Remote Controller
24
Chapter 3
2. Create the local_array tag, which stores the data in this controller.
Tag Name
Type
local_array
data_type [length]
where:
data_type is the data type of the data that the message sends or receives, such as
DINT, REAL, or STRING.
length is the number of elements in the local array.
Create a user-defined data type to store the configuration variables for the message
to each controller.
Some of the required members of the data type use a string data type.
If your paths or remote tag names or addresses use less than 82 characters,
you have the option of creating a new string type that stores fewer
characters. This lets you conserve memory.
To create a string type, click File > New Component > String Type.
If you create a string type, use it in place of the STRING data type.
To store the configuration variables for the message to each controller, create the
following user-defined data type.
Data Type
Path
STRING
RemoteElement
STRING
Style
Description
25
Chapter 3
Store the configuration properties for each controller in an array. Before each
execution of the MSG instruction, your logic loads new properties into the
instruction. This sends the message to another controller.
1. To store the configuration properties for the message, create the following
array.
Tag Name
Type
Scope
message_config
MESSAGE_CONFIGURATION[number](1)
Any
(1)
2. In the message_config array, enter the path to the first controller that
receives the message.
26
Chapter 3
Example:
Type the path to the remote controller.
OR
Click Browse and browse to the remote
controller.
3. In the message_config array, enter the tag name or address of the data in the
first controller to receive the message. Enter the path and remote element
for each additional controller.
4. Enter the path and remote element for each additional controller.
Tag Name
Value
message_config
{}
message_config[0]
{}
message_config[0].Path
message_config[0].RemoteElement
message_config[1]
{}
message_config[1].Path
message_config[1].RemoteElement
27
Chapter 3
1. The XIO instruction conditions the rung to continuously send the message.
2. The first COP instruction loads the path for the message. The value of
index determines which element the instruction loads from message_config.
The instruction loads one element from message_config.
3. The second COP instruction loads the tag name or address of the data in
the controller that receives the message. The value of index determines
which element the instruction loads from message_config. The instruction
loads one element from message_config.
28
Chapter 3
On this tab
If you want to
Type or select
Configuration
Message Type
Source Element
Number Of Elements 1
Destination Element
local_array[*]
Index
Message Type
Source Element
local_array[*]
Index
Number Of Elements 1
Communication
Destination Element
Path
Cache Connections
After the MSG instruction sends the message, the following actions occur.
1. The first ADD instruction increments the index. This lets the logic load the
configuration properties for the next controller into the MSG instruction.
2. The second ADD instruction increments the LocalIndex member of the
MSG instruction. This lets the logic load the value from the next controller
into the next element of local_array.
29
Chapter 3
When the index equals the local_array_length, the controller sends the message to
all other controllers.
1. The first CLR instruction sets the index equal to 0. This lets the logic load
the configuration properties for the first controller into the MSG
instruction and start the sequence of messages again.
2. The second CLR instruction sets the LocalIndex member of the MSG
instruction equal to 0. This lets the logic load the value from the first
controller into the first element of local_array.
30
Index
A
array
controller configuration 26
B
block transfer
guidelines 13
buffer
for unconnected messages 12, 14
C
cache
connection 11
communicate
message instruction 9
other controllers 9
connection
cache 11
controller
message properties 28
messages 9
M
message
cache connection 11
controller 9
convert between 16 and 32-bit data 16
example illustration 9
limits 10
manage multiple messages 19
processing 9
queue 10
to a single controller 9
to multiple controllers 23
unconnected buffer 12, 14
P
processing
message 9
Q
queue
message 10
D
data type
convert data 16
message configuration 25
T
tag
guidelines for messages 13
organize for message 9
G
guidelines
messages 13
L
ladder logic
manage messages 19
31
Installation assistance
If you experience a problem within the first 24 hours of installation, review the information that is contained in this manual. You can
contact Customer Support for initial help in getting your product up and running.
United States or Canada
1.440.646.3434
Use the Worldwide Locator available at http://www.rockwellautomation.com/locations, or contact your local Rockwell
Automation representative.
Contact your distributor. You must provide a Customer Support case number (call the phone number above to obtain one) to
your distributor to complete the return process.
Please contact your local Rockwell Automation representative for the return procedure.
Documentation feedback
Your comments will help us serve your documentation needs better. If you have any suggestions on how to improve this document,
complete the feedback form, publication RA-DU002.
Copyright 2014 Rockwell Automation, Inc. All rights reserved. Printed in the U.S.A.