[Ethercat Master]
Description
Register Cyclic Callback Function.
Syntax
int attachCyclicCallback(void (*callback)(void));
Parameters
[in] void (*callback)(void)
The cyclic callback function to be registered, which has no parameters and no return value.
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()
.
Example
#include "Ethercat.h" EthercatMaster master; EthercatDevice_Generic slave; void CyclicCallback() { // put your cyclic Callback function here. } void setup() { master.begin(); slave.attach(0, master); master.attachCyclicCallback(CyclicCallback); master.start(1000000, ECAT_SYNC); // 1000000 ns = 1 ms } void loop() { }
Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.