Message (MSG)

This information applies to the
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370,
GuardLogix
5570,
Compact GuardLogix
5380,
CompactLogix
5380,
CompactLogix
5480,
ControlLogix
5580, and
GuardLogix
5580 controllers.
The MSG instruction asynchronously reads or writes a block of data to another module on a network.
This is a transitional instruction. Follow these steps when using it:
  • In ladder logic, insert an instruction to toggle the rung-condition-in from false to true each time the instruction should execute.
  • In a Structured Text routine, insert a condition for the instruction to cause it to execute only on a transition.
Available Languages
Ladder Diagram
MSG_LD_avail_v31
Function Block
This instruction is not available in function block.
Structured Text
MSG(MessageControl);
Operands
Ladder Diagram
Operand
Type
Format
Description
Message
MSG
tag
Message structure
Structured Text
Operand
Type
Format
Description
Message
MSG
tag
Message structure
See for more information on the syntax of expressions within structured text.
MESSAGE Structure
IMPORTANT:
If you check the status bits more than once:
Use a copy of the bits if you check them in more than one place in your logic. Otherwise, the bits may change during the scan and your logic won’t work as you expect it.
One way to make a copy is to use the FLAGS word. Copy the FLAGS word to another tag and check the bits in the copy.
IMPORTANT:
Do not change the following bits of a MSG instruction:
  • DN
  • EN
  • ER
  • EW
  • ST
Do not change these bits either by themselves or as part of the FLAGS word. If you do, the controller may have a non-recoverable fault. The controller clears the project from its memory when it has a non-recoverable fault.
Mnemonic
Data Type
Description
.FLAGS
INT
The .FLAGS member provides access to the status members (bits) in one, 16-bit word.
This bit
2
Is this member
.EW
4
.ER
5
.DN
6
.ST
7
.EN
8
.TO
9
.EN_CC
Important:
Do not change the EW, ER, DN, or ST bits of the FLAGS member. For example, do not clear the entire FLAGS word. The controller ignores the change and uses the internally-stored values of the bits.
.ERR
INT
If the .ER bit is set, the error code word identifies error codes for the MSG instruction.
.EXERR
INT
The extended error code word specifies additional error code information for some error codes.
.REQ_LEN
INT
The requested length specifies how many words the message instruction will attempt to transfer.
.DN_LEN
INT
The done length identifies how many words actually transferred.
.EW
BOOL
The enable waiting bit is set when the controller detects that a message request has entered the queue. The controller resets the.EW bit when the.ST bit is set.
Important:
Do not change the EW bit. The controller ignores the change and uses the internally-stored value of the bit.
.ER
BOOL
The error bit is set when the controller detects that a transfer failed. The .ER bit is reset the next time the EnableIn goes from false to true.
Important:
Do not change the ER bit. The controller ignores the change and uses the internally-stored value of the bit.
.DN
BOOL
The done bit is set when the last packet of the message is successfully transferred. The .DN bit is reset the next time the EnableIn goes from false to true.
Important:
Do not change the DN bit. The controller ignores the change and uses the internally-stored value of the bit.
.ST
BOOL
The start bit is set when the controller begins executing the MSG instruction. The .ST bit is reset when the .DN bit or the .ER bit is set.
Important:
Do not change the ST bit. The controller ignores the change and uses the internally-stored value of the bit.
.EN
BOOL
The enable bit is set when the EnableIn goes true and remains set until either the .DN bit or the .ER bit is set and the EnableIn is false. If the EnableIn goes false, but the .DN bit and the .ER bit are cleared, the .EN bit remains set.
Important:
Do not change the EN bit. The controller ignores the change and uses the internally-stored value of the bit.
.TO
BOOL
If you manually set the .TO bit, the controller stops processing the message and sets the .ER bit.
.EN_CC
BOOL
The enable cache bit determines how to manage the MSG connection. If you want the controller to maintain the connection (such as when you repeat the same MSG instruction many times), set the .EN_CC bit. If you rarely execute the MSG instruction and have other needs for a controller connection, clear the .EN_CC bit.
Connections for MSG instructions going out the serial port are not cached, even if the .EN_CC bit is set.
.ERR_SRC
SINT
Shows the error path in the Message Configuration dialog.
.DestinationLink
INT
To change the Destination Link of a
DH+
or CIP with Source ID message, set this member to the required value.
.DestinationNode
INT
To change the Destination Node of a
DH+
or CIP with Source ID message, set this member to the required value.
.SourceLink
INT
To change the Source Link of a
DH+
or CIP with Source ID message, set this member to the required value.
.Class
INT
To change the Class parameter of a CIP Generic message, set this member to the required value.
.Attribute
INT
To change the Attribute parameter of a CIP Generic message, set this member to the required value.
.Instance
DINT
To change the Instance parameter of a CIP Generic message, set this member to the required value.
.LocalIndex
DINT
If you use an asterisk [*] to designate the element number of the local array, the LocalIndex provides the element number. To change the element number, set this member to the required value.
If the message:
Then the local array is the:
Reads data
Destination element
Writes data
Source element
.Channel
SINT
To send the message out a different channel of the 1756-DHRIO module, set this member to the required value. Use either the ASCII character A or B.
.Rack
SINT
To change the rack number for a block transfer message, set this member to the required rack number (octal).
.Group
SINT
To change the group number for a block transfer message, set this member to the required group number (octal).
.Slot
SINT
To change the slot number for a block transfer message, set this member to the required slot number.
If the message goes over this network:
Then specify the slot number in:
Universal remote I/O
octal
ControlNet
decimal (0-15)
.Path
STRING
To send the message to a different controller, set this member to the new path.
Enter the path as hexadecimal values.
Omit commas [,]
For example, for a path of 1, 0, 2, 42, 1, 3, enter $01$00$02$2A$01$03.
To browse to a device and automatically create a portion or all of the new string, right-click a string tag and choose Go to Message Path Editor.
.RemoteIndex
DINT
If you use an asterisk [*] to designate the element number of the remote array, the RemoteIndex provides the element number. To change the element number, set this member to the required value.
If the message
Then the remote array is the
Reads data
Source element
Writes data
Destination element
.RemoteElement
STRING
To specify a different tag or address in the controller to which the message is sent, set this member to the required value. Enter the tag or address as ASCII characters.
If the message
Then the remote array is the
Reads data
Source element
Writes data
Destination element
.UnconnectedTimeout
DINT
The time out for an unconnected message or for making a connection. The default value is 30 seconds.
If the message is unconnected, the ER bit turns on if the controller doesn’t get a response within the UnconnectedTimeout time.
If the message is connected, the ER bit turns on if the controller doesn’t get a response for making the connection within the UnconnectedTimeout time.
.ConnectionRate
DINT
Time out for a connected message once it has a connection. This time out is for the response from the other device.
This time out applies only after the connection is made.
The time out = ConnectionRate x TimeoutMultiplier
The default ConnectionRate is 7.5 seconds.
The default TimeoutMultiplier is 0 (which equates to a multiplication factor of 4).
The default time out for connected messages is 30 seconds (7.5 seconds x 4 = 30 seconds).
To change the time out, change the ConnectionRate and leave the TimeoutMultiplier at the default value.
.TimeoutMultiplier
SINT
Description
The MSG instruction transfers elements of data. This is a transitional instruction:
  • In ladder diagram, toggle the EnableIn from cleared to set each time the instruction executes.
  • The size of each element depends on the data types you specify and the type of message command you use.
MSG Instruction
Where
Description
1
EnableIn is true
.EN is set
.EW is set
connection is opened
2
message is sent
.ST is set
.EW is cleared
3
message is done or errored EnableIn is false
.DN or .ER is set
.ST is cleared
connection is closed (if .EN_CC = 0)
.EN is cleared (because the EnableIn is false)
4
EnableIn is true and .DN or .ER was previously set
.EN is set
.EW is set
connection is opened
.DN or .ER is cleared
5
message is sent
.ST is set
.EW is cleared
6
message is done or errored and EnableIn is still true
.DN or .ER is set
.ST is cleared
connection is closed (if .EN_CC = 0)
7
EnableIn goes false and .DN or .ER is set
.EN is cleared
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. See Common Attributes for operand-related faults.
Execution
Ladder Diagram
Condition/State
Action Taken
Prescan
The .EWS, .ST, .DN, and .ER bits are cleared.
Rung-condition-in is false
See MSG Flow Chart (False)
Rung-condition-in is true
See MSG Flow Chart (True)
Postscan
N/A
Structured Text
Condition/State
Action Taken
Prescan
See Prescan in the Ladder Diagram table
Normal execution
See MSG Flow Chart (True)
Postscan
See Postscan in the Ladder Diagram table
MSG Flow Chart (False)
MSG Flow Chart (False)
MSG Flow Chart (True)
MSG Flow Chart True
Example
Ladder Diagram
MSG_LD_ex_v31
Structured Text
MSG (MessageControl);
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.