I want to find...

Search

Shares

Table of Content

EthercatMaster.detachCyclicCallback()

[Ethercat Master]

Description

Unregister Cyclic Callback Function.

Syntax

int detachCyclicCallback();

Parameters

None.

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() {

}

void setup() {
    master.begin();
    slave.attach(0, master);
    master.attachCyclicCallback(CyclicCallback);
    master.start(1000000, ECAT_SYNC);  // 1000000 ns = 1 ms

    delay(5000);
    master.stop();
    master.detachCyclicCallback();
    master.end();
}

void loop() {
    // ...
}

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

Leave a Comment

Scroll to Top