EtherCAT Set State
Libraries:
Simulink Real-Time /
EtherCAT
Description
The EtherCAT Set State block sets the state of the EtherCAT® network to the value passed in 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. |
Output
Prev State — Previous state of the network
1
| 2
| 4
| 8
This port returns the value of the previous setting of the
New State
port.
Error — Report an EtherCAT state error
0
| integer
If no error occurs, this port
returns 0
. Otherwise, it returns a nonzero
value.
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 |
Timeout — Time to wait for the network to change state
integer
Enter the number of seconds to wait for the EtherCAT network state to transition.
Set the timeout to 0
to return immediately. If you
specify a nonzero Timeout value, in the Configuration
Parameters Solver pane, set the Fixed-step
size parameter to a value larger than the
Timeout value.
Programmatic Use
Block Parameter:
timeout |
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 R2020b
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)