eipReadAttr
Function Block A function block groups an algorithm and a set of private data. It has inputs and outputs. - Sends an explicit message (UCMM) to an EtherNet IP EtherNet/IP™ is an open industrial application layer protocol for industrial automation applications. The EtherNet/IP application layer protocol is based on the CIP layer. adapter to read a single CIP Common Industrial Protocol - CIP allows complete integration of control with information, multiple CIP Networks, and Internet technologies. attribute.
Inputs
Input |
Data Type |
Range |
Unit |
Default |
Description |
---|---|---|---|---|---|
Attr |
UINT |
|
|
|
Identifier of the CIP attribute. |
Class |
UINT |
|
|
|
Class identifier of the CIP object. |
Data |
UINT[] |
|
|
|
Buffer where to store the received data. If the actual attribute length is greater than the size of this array, the value is truncated when read. |
Inst |
UINT |
|
|
|
Instance identifier of the CIP object. |
SrvIP |
STRING |
|
|
|
IP address of the server (adapter) (e.g., configured in the EtherNet Ethernet is a large, diverse family of frame-based computer networking technologies that operate at many speeds for local area networks (LANs)./IP Scanner configuration). |
Snd |
BOOL |
FALSE, TRUE |
N/A |
No default |
A rising edge The transition of a digital signal from low to high. AKA: positive edge. on this input starts the exchange. The DONE output signals the end of exchange. |
Outputs
Output |
Data Type |
Range |
Unit |
Description |
---|---|---|---|---|
Done |
BOOL |
FALSE, TRUE |
N/A |
This output is TRUE during one cycle when the exchange is finished, whether the exchange succeeded or failed.
|
EmErr |
UINT |
|
|
In case of a UCMM error, this is the CIP general status error code. |
EmErrExt |
UINT |
|
|
In case of a UCMM error, this is the CIP extended status error code. |
Err |
UINT |
|
|
Main error report. Can be one of these values: |
RcvSize |
UINT |
|
|
Actual size of the CIP attribute answered by the server. If this size is greater than the size of the DATA input array, it indicates the value was truncated. |
Remarks
- The CIP instance number can be 16-bits [1...65535].
- The servers (adapters) accessed by this block must be configured in the EtherNet/IP Scanner fieldbus An industrial network system for real-time distributed control (e.g., CAN or PROFIBUS, Sercos®). It is a way of connecting instruments in a plant design. configuration.
- Only one explicit message (read or write) can be sent at one time to the same server.
- If another message is pending you receive the error report 3 (busy) after calling the block to start a new exchange.
- Consider SerializeIn and SerializeOut functions A function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. for extracting data from the read buffer.
FBD Language Example
Not available.
FFLD Language Example
Not available.
IL Language Example
Not available.
ST Language Example
// used variables
// Inst_eipReadAttr : eipReadAttr ;
// bRead : BOOL ; (* request for READ *)
// DataRead : ARRAY [0 .. 15] OF USINT ; (* read data *)
// Server identification and CIP things
#define SRVIP '192.168.33.21'
#define CLASSID UINT#100
#define INSTID_READ UINT#1
#define ATTRID UINT#3
/////////////////////////////////////////////////////////////////////////////////////////
// requested READ command
if bRead then
Inst_eipReadAttr (bRead, SRVIP, CLASSID, INSTID_READ, ATTRID, DataRead);
end_if;
// READ answer here ?
if Inst_eipReadAttr.Done then
// check answer - if OK answered data is in DataRead array
if Inst_eipReadAttr.Err = 0 then
printf ('READ ok - size = %lu bytes',
any_to_dint (Inst_eipReadAttr.RcvSize));
else
printf ('READ Error %lu (UCMM Error %lu, %lu)',
any_to_dint (Inst_eipReadAttr.Err),
any_to_dint (Inst_eipReadAttr.EmErr),
any_to_dint (Inst_eipReadAttr.EmErrExt));
end_if;
// reset New start of the microprocessor. READ command and block input
Inst_eipReadAttr (false, SRVIP, CLASSID, INSTID_READ, ATTRID, DataRead);
bRead := false;
end_if;
See Also