我想找...

搜尋

分享

目錄

EthercatMaster.detachCyclicCallback()

[Ethercat Master]

描述

Unregister Cyclic Callback Function.

語法

int detachCyclicCallback();

參數

回傳值

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

備註

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

範例

#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.

返回頂端