[EthercatDevice_DmpDIQ_Generic]
Description
Initiates a broken wire detection test on the specified input pins of the EtherCAT slave device.
Derived Class:
Class Name VID PID Inputs Outputs MCU DC Wire Detection EthercatDevice_QECR00DF0D 0x00000bc3 0x0086d300 16 0 O O EthercatDevice_QECR00D88D 0x00000bc3 0x0086d301 8 8 O O EthercatDevice_QECR00DC4D 0x00000bc3 0x0086d304 12 4 O O EthercatDevice_QECR00D4CD 0x00000bc3 0x0086d302 4 12 O O EthercatDevice_QECR11DF0D 0x00000bc3 0x0086d0d2 16 0 O O
Syntax
uint16_t startBrokenWireTest(uint16_t bitMask, uint32_t timeout_ms = 1000);
Parameters
[in] uint16_t bitmask
This parameter is an unsigned 16-bit integer that specifies which input pins to include in the broken wire detection test. Each bit in the bitMask corresponds to an input pin of the EtherCAT slave device, with the following mapping:- Bit 0 indicates digital input pin 0.
- Bit 1 indicates digital input pin 1.
- And so on, up to bit 15 which indicates digital input pin 15
A value of 1 indicates that the corresponding pin should be included in the test, while a value of 0 indicates that it should be excluded.
WARNING: It is crucial to ensure that this parameter does not contain bits set to 1 for input channels that do not exist on the EtherCAT slave device, otherwise this test will not be executed.
[in] uint32_t timeout_ms
Timeout in milliseconds.
Return Value
Return a 16-bit unsigned integer that represents the results of the broken wire detection test. Each bit in the returned value corresponds to an input pin included in the test. The interpretation of each bit is as follows:
- 0: The corresponding pin was either not included in the test or was detected as broken.
- 1: The corresponding pin was included in the test and was detected as connected and not broken.
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; EthercatDevice_QECR00D88D slave; void setup() { Serial.begin(115200); master.begin(); slave.attach(0, master); master.start(); Serial.print(slave.startBrokenWireTest(0xFF)); } void loop() { // ... }
Please see EthercatDevice_DmpDIQ_Generic Class for more QEC DIO slave instructions and API usage.