我想找...

搜尋

分享

目錄

EthercatMaster.begin()

[Ethercat Master]

描述

Initialize the EtherCAT master, scan all EtherCAT slave devices on the network, and switch the EtherCAT state machine to the Pre-Operational state.

語法

int begin(EthernetPort eth = ECAT_ETH_0, const char *eni_filename = NULL);

參數

  • [in] EthernetPort eth
    Selection of the Ethernet interface for EtherCAT communication. The default is ECAT_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 is NULL.

回傳值

Return an error code. If the returned value is zero, it indicates a successful execution of this function.

範例

#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.

返回頂端