我想找...

搜尋

分享

目錄

EthercatDevice_DmpDIQ.startBrokenWireTest()

[EthercatDevice_DmpDIQ_Generic]

描述

Initiates a broken wire detection test on the specified input pins of the EtherCAT slave device.

衍生類別:

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

語法

uint16_t startBrokenWireTest(uint16_t bitMask, uint32_t timeout_ms = 1000);

參數

  • [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:
    1. Bit 0 indicates digital input pin 0.
    2. Bit 1 indicates digital input pin 1.
    3. 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 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.

備註

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;
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類別 for more QEC DIO slave instructions and API usage.

返回頂端