[Ethercat Master]
Description
Save the EtherCAT master settings.
Syntax
int saveSettings(EthercatMasterSettings *settings);
Parameters
[in] EthercatMasterSettings *settings
A pointer to theEthercatMasterSettings
data structure. For more details about theEthercatMasterSettings
parameters, please refer to EtherCAT Master Settings.
Return Value
Return an error code. If the returned value is zero, it indicates a successful execution of this function.
Comment
This function must be called before EthercatMaster::begin()
or after EthercatMaster::end()
.
Example
#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.