EtherCAT Network Connect and Disconnect with LS_Connect and LS_Disconnect
The XMC must connect to the EtherCAT network to communicate with slave devices. This is done using the LS_Connect function block. No commands can be sent to the drives if they are not connected. The EtherCAT network can also be disconnected using the LS_Disconnect function block.
-
LS_Connect will return an error number if the EtherCAT network doesn’t match the project configuration.
-
The EtherCAT slave status flags won’t be active until LS_Connect is successfully executed.
-
Disconnecting the EtherCAT network will cause the status to stop updating.
The following examples can be found in the XMC_SingleAxis_FBs.zip downloadable from Example Applications.
Element Name | Element Type | Description |
---|---|---|
Execute | Input | Edge detected request to execute the function block. |
Done | Output | Status that function block is done. |
Busy | Output | Status that function block is working. |
Error | Output | Status that there was an error executing the function block. |
ErrorID | Output | Error Identification number. |
Element Name | Element Type | Description |
---|---|---|
Execute | Input | Edge detected request to execute the function block. |
Done | Output | Status that function block is done. |
Busy | Output | Status that function block is working. |
Error | Output | Status that there was an error executing the function block. |
ErrorID | Output | Error Identification number. |
EtherCat Network View after executing LS_Connect
Structured Text Example
//Example of LS_Connect Function block to connect EtherCAT network
INST_LS_CONNECT(Execute:=Execute_Connect, ErrorID=>INST_LS_CONNECT.ErrorID);
EtherCAT Network View after executing LS_Disconnect
Structured Text Example
//Example of LS_Disconnect Function block to disconnect the EtherCAT network
INST_LS_DISCONNECT(Execute:=Execute_Disconnect, ErrorID=>INST_LS_DISCONNECT.ErrorID);
LM500