eipWriteAttr

PLCopen motion icon

 Function BlockClosed 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 IPClosed 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 write a single CIPClosed 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

array of UINT

     

Buffer containing the data to write.

Inst

UINT

 

 

 

Instance identifier of the CIP object.

SrvIP

STRING

 

 

 

IP address of the server (adapter) (e.g., configured in the EtherNetClosed 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).

Size

UINT

     

Number of bytes to write.

Cannot exceed 450 bytes.

Snd

BOOL

FALSE, TRUE

N/A

No default

A rising edgeClosed 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.

Warning: This output can be TRUE just after the call to block when starting a new exchange in case of invalid parameters.

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:
0 = No error.
1 = Invalid input arguments.
2 = System is busy (see remarks).
3 = Timeout waiting for the answer (the timeout value is 3 seconds).
4 = UCMM error was returned by the server others = internal errors (reserved for technical support).

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

FBD Language Example

Not available.

FFLD Language Example

Not available.

IL Language Example

Not available.

ST Language Example

// used variables
// Inst_eipWriteAttr : eipWriteAttr ;
// bWrite : BOOL ; (* request for WRITE *)
// DataWrite : ARRAY [0 .. 15] OF USINT; (* written data *)
// uiSizeWrite : UINT := UINT#16 ; (* number of bytes to read *)
// Server identification and CIP things

#define SRVIP '192.168.33.21'
#define CLASSID UINT#100
#define INSTID_WRITE UINT#2
#define ATTRID UINT#3
/////////////////////////////////////////////////////////////////////////////////////////
// requested WRITE command

if bWrite then
Inst_eipWriteAttr (bWrite, SRVIP, CLASSID, INSTID_WRITE, ATTRID,
uiSizeWrite, DataWrite);
end_if;
// WRITE answer here ?
if Inst_eipWriteAttr.Done then
// check answer
if Inst_eipWriteAttr.Err = 0 then
printf ('WRITE ok');
else
printf ('WRITE Error %lu - (UCMM Error %lu, %lu)',
any_to_dint (Inst_eipWriteAttr.Err),
any_to_dint (Inst_eipWriteAttr.EmErr),
any_to_dint (Inst_eipWriteAttr.EmErrExt));
end_if;
// resetClosed New start of the microprocessor. WRITE command and block input
Inst_eipWriteAttr (false, SRVIP, CLASSID, INSTID_WRITE, ATTRID,
uiSizeWrite, DataWrite);
bWrite := false;
end_if;

See Also