[Ethercat Master]
Description
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.
Syntax
int getWorkingCounter();
Parameters
None.
Return Value
Return the working counter for the current cycle.
Comment
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.
Example
#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.