[Ethercat Master]
Description
Set the Global Shift Time for DC-Synchronous mode. If the user does not set the Global Shift Time or sets it to INT32_MAX, the EtherCAT firmware will automatically calculate an appropriate value. For the definition of Global Shift Time, please refer to 1.5 Synchronization.
Syntax
int setShiftTime(int32_t nanoseconds);
Parameters
[in] int32_t nanoseconds
The value of the Global Shift Time to be set, in nanoseconds.
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 after a successful execution of EthercatMaster::begin() and before EthercatMaster::start(), or after a successful execution of EthercatMaster::stop() and before EthercatMaster::end(). This function is non-blocking and can be called within the callback functions, but it is not recommended.
Example
#include "Ethercat.h"
EthercatMaster master;
EthercatDevice_Generic slave;
void setup() {
master.begin();
slave.attach(0, master);
slave.setDc(1000000);
master.setShiftTime(250000); // 250000 ns
master.start(1000000);
}
void loop() {
// ...
}Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.