This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

EtherCAT Set State

Set state of EtherCAT network


Simulink® Real-Time™ Library for EtherCAT®


The EtherCAT Set State block sets the state of the EtherCAT network. Each state has the corresponding integer:

INIT1Initialization – The system finds slave devices and initializes the communication controller.
PREOP2Preoperational — The system uses the communication controller to exchange system-specific initialization data. In this state, the network cannot transmit or receive signal data.
SAFEOP4Safe operational — The network is running and ready for full operation. The master sends input data to the slave device. The slave device output remains in a safe state.
OP8Operational — The network is in full operation. The master sends input data to the slave device. The slave device responds with output data.

Block Inputs and Outputs



New State

Transmission to the EtherCAT network.



Prev State

Previous state of the network.


0 if no error occurs. Otherwise, a nonzero value.

Block Parameters

Device index

A unique integer in the range 0 to 15 that identifies the Ethernet card for an EtherCAT network.

To associate a block with an EtherCAT network, copy the Device index value from the EtherCAT Init block representing that network into the Device index for the block.

The default value of Device index is 0.


Enter the number of seconds to wait for the EtherCAT network state to transition.

Set the timeout to 0 to return immediately.

Sample time

Enter the base sample time or a multiple of the base sample time (-1 means sample time is inherited).

Introduced in R2010b

Was this topic helpful?