[Ethercat Master]
Description
Initialize the EtherCAT master, scan all EtherCAT slave devices on the network, and switch the EtherCAT state machine to the Pre-Operational state.
Syntax
int begin(EthernetPort eth = ECAT_ETH_0, const char *eni_filename = NULL);
Parameters
[in] EthernetPort eth
Selection of the Ethernet interface for EtherCAT communication. The default isECAT_ETH_0
.ECAT_ETH_0
: Only eth0 is used as the EtherCAT communication interface.ECAT_ETH_1
: Only eth1 is used as the EtherCAT communication interface.ECAT_ETH_REDUNDANCY
: Enable EtherCAT Cable Redundancy with eth0 as the primary port and eth1 as the secondary port.
[in] const char *eni_filename
The file name of the EtherCAT Network Information (ENI). For details about the ENI content supported by this library, please refer to EtherCAT Network Information. The default isNULL
.
Return Value
Return an error code. If the returned value is zero, it indicates a successful execution of this function.
Example
#include "Ethercat.h" EthercatMaster master; void setup() { master.begin(); master.start(1000000); // cycle time set as 1 millisecond. } void loop() { }
Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.