[Ethercat Master]
説明
循環コールバック関数を登録します。
構文
int attachCyclicCallback(void (*callback)(void));
媒介変数
[in] void (*callback)(void)
循環コールバック関数を登録します。変数も戻り値もありません。
戻り値
error codeを返します。返された値が 0の場合、この関数が正常に完了したことを示します。
備考
この関数は、 EthercatMaster::begin() が正常に実行された後で、 EthercatMaster::start()の前に、または、 EthercatMaster::stop() が正常に実行された後で、 EthercatMaster::end().
例
#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() {
}詳細は EtherCAT Library User Manual QEC EtherCAT命令とAPI使用法参照