[Ethercat Master]
描述
Get the working counter for the current cycle. It is recommended to use this within the cyclic callback to ensure the working counter is retrieved in the correct cycle.
語法
int getWorkingCounter();
參數
無
回傳值
Return the working counter for the current cycle.
備註
This function must be called after a successful execution of EthercatMaster::start()
and before EthercatMaster::stop()
. This function is non-blocking and can be called within the callback functions.
範例
#include "Ethercat.h" EthercatMaster master; int CurrentWorkingCounter; void CyclicCallback() { CurrentWorkingCounter = master.getWorkingCounter(); } void setup() { Serial.begin(115200); master.begin(); master.attachCyclicCallback(CyclicCallback); master.start(); } void loop() { Serial.print("Current Working Counter: "); Serial.println(CurrentWorkingCounter); delay(1000); }
Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.