Main Content

EtherCAT Set Device State

Set state of EtherCAT network

  • Library:
  • Simulink Real-Time / EtherCAT

  • EtherCAT Set Device State block

Description

The EtherCAT Set Device State block sets the state of the EtherCAT® network to the value passed through the New State port.

Ports

Input

expand all

StateValueDescription
INIT1Initialization — The system finds terminal 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 supervisor sends input data to the terminal device. The terminal device output remains in a safe state.
OP8Operational — The network is in full operation. The supervisor sends input data to the terminal device. The terminal device responds with output data.

The port takes a Boolean value. When true (1), the block sends a new state request. When false (0), the block does nothing.

Output

expand all

This port returns the value of the previous state of the device. That value might not be the same as the previous state of this block.

If no error occurs, this port returns 0. Otherwise, it returns a nonzero value. For more information, see EtherCAT Error Codes.

Parameters

expand all

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

Programmatic Use

Block Parameter: device_id

Select an EtherCAT device from the list of available devices provided by the ENI configuration file. The configuration file is selected by the EtherCAT Init block.

Programmatic Use

Block Parameter: device_name

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

Programmatic Use

Block Parameter: sample_time
Introduced in R2021b