サイト内検索

検索

Shares

Table of Content

EthercatMaster.detachCyclicCallback()

[Ethercat Master]

説明

循環コールバック関数の登録を解除します。

構文

int detachCyclicCallback();

媒介変数

なし

戻り値

error codeを返します。返された値が 0の場合、この関数が正常に完了したことを示します。

備考

この関数は、 EthercatMaster::begin() が正常に実行された後で、 EthercatMaster::start()の前に、または、 EthercatMaster::stop() が正常に実行された後で、 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() {
    // ...
}

詳細は EtherCAT Library User Manual QEC EtherCAT命令とAPI使用法参照

上部へスクロール