我想找...

搜尋

分享

目錄

EthercatMaster.saveSettings()

[Ethercat Master]

描述

Save the EtherCAT master settings.

語法

int saveSettings(EthercatMasterSettings *settings);

參數

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

回傳值

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

備註

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.

返回頂端