EtherCAT Set Device State
Libraries:
Simulink Real-Time /
EtherCAT
Description
The EtherCAT Set Device State block sets the state of a device on the
EtherCAT® network to the value passed through the New State
port.
Examples
EtherCAT Protocol with Beckhoff Analog IO Subordinate Devices EL3062 and EL4002
Communicate with EtherCAT devices using the Beckhoff® analog I/O terminals EL3062 and EL4002.
EtherCAT Protocol with Beckhoff Digital IO Subordinate Devices EL1004 and EL2004
Communicate with EtherCAT devices using the Beckhoff digital I/O terminals EL1004 and EL2004.
EtherCAT Protocol Sequenced Writing SoE Subordinate Device Configuration Variables
Use SoE blocks and a simple state machine to write configuration values to variables that can only be written before going to EtherCAT Op state.
EtherCAT Protocol Sequenced Writing CoE Subordinate Device Configuration Variables
Use CoE blocks and a simple state machine to write configuration values to variables that can only be written before going to EtherCAT Op state.
EtherCAT Protocol Detect Network Failure and Reset
Use the EtherCAT Notifications block to detect a failure in the connected network and to restart the network when the failure is corrected.
EtherCAT Protocol Motor Velocity Control with Accelnet Drive
Control the velocity of a motor by using EtherCAT communication.
EtherCAT Protocol Motor Position Control with Accelnet Drive
Control the position of a motor by using EtherCAT communication.
Generate ENI Files for EtherCAT Devices
Generate EtherCAT network information (ENI) files to use in Simulink® Real-Time™ with EtherCAT devices.
Ports
Input
New State — State transmitted to the EtherCAT network
1
| 2
| 4
| 8
State | Value | Description |
---|---|---|
INIT | 1 | Initialization — The system finds terminal devices and initializes the communication controller. |
PREOP | 2 | Preoperational — The system uses the communication controller to exchange system-specific initialization data. In this state, the network cannot transmit or receive signal data. |
SAFEOP | 4 | Safe 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. |
OP | 8 | Operational — The network is in full operation. The supervisor sends input data to the terminal device. The terminal device responds with output data. |
Enable — Enables block to send state request
0
| 1
The port takes a Boolean value. When true (1), the block sends a new state request. When false (0), the block does nothing.
Output
Prev State — Previous state of the selected device
1
| 2
| 4
| 8
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.
Error — Report an EtherCAT state error
0
| integer
If no error occurs, this port
returns 0
. Otherwise, it returns a nonzero value. For
more information, see EtherCAT Error Codes.
Parameters
Network Device Index — EtherCAT network identifier
0
(default) | 0-11
To associate a block with an EtherCAT network, enter the Network Device Index value from the EtherCAT Init block representing that network into the Network Device Index for the block.
Programmatic Use
Block Parameter:
device_id |
SubDevice Name — Name of EtherCAT subordinate device
character vector
Select an EtherCAT subordinate device from the list of available subordinate devices provided by the ENI configuration file. The configuration file is selected by the EtherCAT Init block.
Programmatic Use
Block Parameter:
device_name |
Sample time — Sample time of block
-1
(default) | numeric
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 |
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2021b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)