TechTalk - RSLogix5 : Inter-PLC Communication Using MSG Block... The Basics

TechTalk - RSLogix5 : Inter-PLC Communication Using MSG Block... The Basics

Xybernetics Rockwell RSLogix5 - Inter-PLC Communication Using MSG Block... The Basics

This article focus on how to write a logic that facilitates communication (data exchange) between two PLCs. The snippet below is a very simple technique use to exchange data between “This PLC” (PLC-5 where the snippet resides) and “Target Device” (another remote PLC-5). The MSG block is triggered to read data from “Target Device” (remote PLC-5) at file number N7:20 every 2 seconds (using TON function block T1:10). A total of 10 elements are being read from “Target Device”every 2 seconds (N7:20, N7:21, N7:22……N7:29) and store in “This PLC” from N7:20 (N7:20, N7:21, N7:22……N7:29) systematically.

Xybernetics Rockwell RSLogix5 - Inter-PLC Communication Using MSG Block... The Basics

This PLC-5
Communication Command

Specifies whether the MSG instruction performs a read or a write operation and the type of processor the message is going to. Double-click the field and select the command from the drop-down list.

Below are the description of the command parameters.

MSG Communication Command Parameter
The following table describes the available communication commands for the MSG instruction.

If you want the instruction to Select this command
Read data identified by a type code. This command reads data structures without you specifying the actual word length. For example, if you choose a typed read of the PLC-5 timer data section with a requested data size of 5 elements, the MSG instruction reads 15 words (5 timer structures of 3 words each). PLC-5 Typed Read
Write data identified by a type code. This command writes data structures without you specifying the actual word length. PLC-5 Typed Write
Read 16-bit words from any area of the PLC-2 data table or PLC-2 compatibility file. PLC-2 Unprotected Read
Write 16-bit words from any area of the PLC-2 data table or PLC-2 compatibility file. PLC-2 Unprotected Write
Read data identified by a type code. This command reads data structures without you specifying the actual word length. It provides additional data verification for communications between a SLC 500 and PLC-5 processor. PLC-5 Typed Read from SLC
Write data identified by a type code. This command writes data structures without you specifying the actual word length. It provides additional data verification for communications between a SLC 500 and PLC-5 processor. PLC-5 Typed Write from SLC
Read a range of words, starting at the address specified for the external address in the MSG control file and reading sequentially the number of words specified for the requested size field in the MSG control file. The data that is read is stored, starting at the address specified for the internal address in the MSG control file. This is used for communicating between a PLC-5 and SLC 500 processor. SLC Typed Logical Read
Write a range of words, starting at the address specified for the internal address in the MSG control file and writing sequentially the number of words specified for the requested size field in the MSG control file. The data from the internal address is written, starting at the address specified for the external address in the MSG control file. This is used for communicating between a PLC-5 and SLC 500 processor. SLC Typed Logical Write
Read a range of words, starting at the address specified for the external address in the MSG control file and reading sequentially the number of words specified for the requested size field in the MSG control file. The data that is read is stored, starting at the address specified for the internal address in the MSG control file. PLC-3 Word Range Read
Write a range of words, starting at the address specified for the internal address in the MSG control file and writing sequentially the number of words specified for the requested size field in the MSG control file. The data from the internal address is written, starting at the address specified for the external address in the MSG control file. PLC-3 Word Range Write
Provide E-Mail functionality (available with a PLC-5E Series F only. The E-Mail parameters can then be defined (port 2 or 3A only). This function sends E-Mail only and does not receive E-Mail. E-Mail

Data Table Address
The data table address of the processor containing the message instruction. If the operation is “write”, this address is the starting word of the source file. If the operation is “read”, this address is the starting word of the destination file.

Size in Elements
The number of elements (1-1000) to be transferred.

Port Number
The channel for message communications. Valid options are: 0, 1A, 1B, 2A, 2B, and 3A for the ASCII command. Double-click the field and select the channel from the drop-down list.

Target PLC-5

Data Table Address
The starting address of the source or destination file in the target processor.

Local Station Address
The local station address on the DH+ (0 to 77 octal). If you communicate with another processor in the local link, this address is the address of the target station on the local link. If you communicate with a target station on a remote link, this address is the station number of the communication adapter module that bridges the data highway.

Local/Remote
Select Local or Remote by double-clicking the field and making your choice from the drop-down list.
Local: the message is sent to a device on the local DH+ link.
Remote: the message is sent through a bridge (DH, DH II, etc.) to another DH+ link. If you select Remote, the Node, User, and Link ID parameters will appear on the dialog.

Remote Link Type
Select DH, DH II, or Other, by double-clicking the field and making your choice from the drop-down list. This is the type of link that connects the remote link to the local DH+. DH II will then display fields for the Node, User, and Link ID parameters. DH and Other will display fields for Remote Station Address and Remote Bridge Link ID.

Node (DH II)
Enter the remote node number.

User (DH II)
Enter the remote node user number.

Link ID (DH II)
The remote link where the processor you want to communicate with resides.

Remote Station Address (DH and Other)
This is the DH address of the target station. PLC-2 and PLC-3 processors require communication adapter modules (1771-KA2 and 1775-KA respectively) when they operate as stations on data highway. In these configurations, the remote station address is the address of the communication adapter module.

Remote Bridge Link ID (DH and Other)
This is the remote link where the processor you want to communicate with resides.

Control Bits

Ignore if timed out (TO)
If you set the .TO bit through ladder logic, the processor stops processing the message and sets the .ER bit. A message will automatically time out in 30-60 seconds.

To be retried (NR)
If the target processor does not respond to the first MSG request, this bit is set. The .NR bit is reset when the associated rung goes from false-to-true.

Awaiting execution (EW)
This bit is set when the processor detects that a message request entered the queue. The processor resets the .EW bit when the .ST bit is set.

Continuous run (CO)
Set this bit manually if you want repeated operation of the MSG instruction after the first scan, independent of whether the processor continues to scan the rung. Reset the .CO bit if you want the rung condition to initiate messages (return to non-continuous mode).

Error (ER)
This bit is set when the processor detects that the message transfer failed. The .ER bit is reset the next time the associated rung goes from false-to-true.

Message done (DN)
Set when the last packet of the MSG instruction transferred. The .DN bit is reset the next time the associated rung goes from false-to-true. The .DN bit is only active in non-continuous mode.

Message transmitting (ST)
Set when the processor begins executing the MSG instruction. The .ST bit is reset when the .DN bit or .ER bit is set.

Message enabled (EN)
Set when the rung goes true. This bit shows the instruction is enabled (the instruction being executed). In non-continuous mode, .EN bit remains set until the message is completed and the rung goes false. In continuous mode, once .EN is set, it remains set regardless of the rung condition.

Error

Error Code (Hex)
Displays the error code if a problem occurs during message transmission.

Error Description
Displays a description of the error code.

Reference

  • RSLogix5 Help File