I want to find...

Search

Shares

Table of Content

EthercatDevice_Dmp.tryToGetSystemPowerVoltage()

[EthercatDevice_Dmp]

Description

Try to get the system voltage in a non-blocking manner. If it returns true, the reading process is complete, and you must immediately call getSystemPowerVoltage() to get the value. Otherwise, it indicates that the process is not yet complete.

Syntax

bool tryToGetSystemPowerVoltage();

Parameters

None.

Return Value

Return a boolean value indicating whether the non-blocking read process has completed.

  • true: Completed.
  • false: In progress.

Comment

This function must be called after a successful execution of EthercatMaster::begin(). This function is non-blocking and can be called within the callback functions.

Example Code

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_QECR11DT0H slave;
double SystemVoltage;

void CyclicCallback() {
  if (slave.tryToGetSystemPowerVoltage()) {
    SystemVoltage = slave.getSystemPowerVoltage();
  }
}

void setup() {
  Serial.begin(115200);

  master.begin();
  slave.attach(0, master);
  master.attachCyclicCallback(CyclicCallback);
  master.start();

}

void loop() {
  Serial.print("System Voltage: ");
  Serial.println(SystemVoltage);
  // ...
}

Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.

Leave a Comment

Scroll to Top