我想找...

搜尋

函式庫參考

目錄

EthercatMaster.readSettings()

[Ethercat Master]

描述

Read the current EtherCAT master settings.

語法

int readSettings(EthercatMasterSettings *settings);

參數

  • [in] EthercatMasterSettings *settings
    A pointer to the EthercatMasterSettings data structure. For more details about the EthercatMasterSettings parameters, please refer to EtherCAT 主站設定.

回傳值

回傳錯誤碼。若回傳值為零,表示此函式執行成功。

備註

This function must be called before EthercatMaster::begin() or after EthercatMaster::end().

範例

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_Generic slave;

void setup(void) {
  EthercatMasterSettings settings;

  Serial.begin(115200);
  while (!Serial);

  master.readSettings(&settings);
  settings.DcSyncMode = ECAT_BUS_SHIFT;
  settings.StateMachineTimeoutI2P = 3000;
  settings.StateMachineTimeoutP2S = 10000;
  settings.StateMachineTimeoutS2O = 1000;
  settings.ScanNetworkTimeout = 5000;
  settings.StartMasterTimeout = 3000;
  settings.StartDeviceTimeout = 2000;
  master.saveSettings(&settings);

  Serial.println(master.begin());
  slave.attach(0, master);

  Serial.println(master.start(1000000, ECAT_SYNC));
}

void loop() {

}

Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.

返回頂端