SEND_REQ Example - Get_Attributes_Single
Original instructions
Overview
The following unconnected explicit messaging example shows you how to use the SEND_REQ function block to retrieve the vendor ID from a third-party device—in this case a Rockwell Automation 1734-AENT PointIO EtherNet/IP adapter (revision 2.1)—using the Get_Attributes_Single service.
You can perform the same explicit messaging service using the Online Action window of the Control Expert EtherNet/IP configuration tool.
Implementing the SEND_REQ Function Block
To implement the SEND_REQ function block, you need to create and assign variables for the following blocks, as follows:
Input Variables
Variables need to be created and assigned to input pins. For the purpose of this example, variables have been created—and named—as described below. (You can, of course, use different variable names in your explicit messaging configurations.)
Input pin
Variable
Data type
IN
start
BOOL
IN
Send_data_bytes
INT
CODE
Request_Code
INT
EMIS
Data_to_Send
Array [0...4] of 5 INT
Note: The value of Send_data_bytes equals the length of the Data_to_Send variable, in bytes. In this example, Send_data_bytes = 16#000A.
Input/Output Variables
A single variable needs to be created and assigned to the dual input/output GEST pins. For the purpose of this example, a variable has been created—and named—as described below. (You can, of course, use different variable names in your explicit messaging configurations.)
Input pin
Variable
Data type
GEST
Management_Param
Array [0...3] of 4 INT
Output Variables
A variable also needs to be created and assigned to the single RECP output pin. (The names assigned to the output variable apply only to this example, and can be changed in your explicit messaging configurations.)
Output pin
Variable
Data type
RECP
Received_Data
Array [0...3] of 4 INT
Configuring the Address Variable
The Address variable identifies the explicit message originating device—-in this example, the TSX ETC 100 communication module—and the target device. Note that the Address variable does not include the Xway address elements {Network.Station} because we are not bridging through another PLC station. Use the ADDR function to convert the following character string to an address:
ADDR(‘0.4.0.10’), where:
Configuring the Request_Code Variable
The Request_Code variable identifies the function type for the SEND_REQ function block—in this case, a CIP request:
Variable
Description
Value (hex)
Request_Code
Code identifies a CIP request
16#000E
Configuring the Data_to_Send Variable
The Data_to_Send variable identifies the type of explicit message and the CIP request:
Variable
Description
Value (hex)
Data_to_Send[0]
Message type:
  • 0000 (unconnected), or
  • 0001 (connected)
In this example, unconnected is selected.
16#0000
Data_to_Send[1]
High byte = Request path size (03)
Low byte = Service: Get_Attribute_Single (0E)
16#030E
Data_to_Send[2]
High byte = Class (01)
Low byte = Class Segment (20)
16#0120
Data_to_Send[3]
High byte = Instance (01)
Low byte = Instance Segment (24)
16#0124
Data_to_Send[4]
High byte = Attribute (01)
Low byte = Attribute Segment (30)
16#0130
Configuring the Management_Param Variable
The Management_Param variable manages the explicit message:
Variable
Description
Value (hex)
Management_Param[0]
High byte = Exchange number (managed by system)
Low byte = Activity bit (managed by system)
(read-only)
Management_Param[1]
High byte = Operation report
Low byte = Communication report
(read-only)
Management_Param[2]
Timeout in ms—0 indicates infinite
16#0000
Management_Param[3]
At input = Length of Data_to_Send variable (in bytes)
At output = Length of Received_Data variable (in bytes)
16#000A
Viewing the Response
Use a Control Expert Animation table to display the Received_Data variable array. Note that the Received_Data variable array consists of the entire data buffer.
To display the CIP response, follow these steps:
Step
Action
1
In Control Expert, select Tools → Project Browser to open the Project Browser.
2
In the Project Browser, select the Animation Tables folder, then click the right mouse button. A pop-up menu appears.
3
Select New Animation Table in the pop-up menu. A new animation table and its properties dialog both open.
4
In the Properties dialog, edit the following values:
Name
Type in a table name. For this example: Received_Data.
Functional module
Accept the default <None>.
Comment
(Optional) Type your comment here.
Number of animated characters
Type in 100, representing the size of the data buffer in words.
5
The completed Properties dialog looks like this:
Click OK to close the dialog.
6
In the animation table’s Name column, type in the name of the variable assigned to the databuffer: Received_Data and hit Enter. The animation table displays the Received_Data variable.
7
Expand the Received_Data variable to display its word array, where you can view the CIP response at Received_Data(0-4):
Note: Each array entry presents 2 bytes of data in little endian format, where the least significant byte is stored in the smallest memory address. For example, ‘8E’ in word[0] is the lower byte, and ‘00’ is the upper byte.