[Ethercat Master]
Description
Get the system time for the current cycle. It is recommended to use this within the cyclic callback to ensure the system time is retrieved in the correct cycle.
Syntax
uint64_t getSystemTime();
Parameters
None.
Return Value
Return the system time 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; uint64_t CurrentSystemTime; void CyclicCallback() { CurrentSystemTime = master.getSystemTime(); } void setup() { Serial.begin(115200); master.begin(); master.attachCyclicCallback(CyclicCallback); master.start(); } void loop() { Serial.print("Current System Time: "); Serial.print((uint32_t)(CurrentSystemTime >> 32)); Serial.print(" "); Serial.println((uint32_t)(CurrentSystemTime & 0xFFFFFFFF)); delay(1000); }
Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.