I want to find...

Search

Shares

Table of Content

EthercatDevice_DmpDIQ.attach()

[EthercatDevice_DmpDIQ_Generic]

Description

Initialize the object of this EtherCAT slave device class and attach it to the object of EthercatMaster class based on the ID of the slave device on the network.

Derived Class:

Class          Name	        VID	        PID       Inputs Outputs   MCU	DC	Wire Detection
EthercatDevice_QECR00D0FS	0x00000bc3	0x0086d303	0	 16	        O		
EthercatDevice_QECR00D0FH	0x00000bc3	0x0086d30A	0	 16	        O	O	
EthercatDevice_QECR00D0TL	0x00000bc3	0x0086d327	0	 32			
EthercatDevice_QECR00D0TH	0x00000bc3	0x0086d801	0	 32	        O	O	
EthercatDevice_QECR00DF0S	0x00000bc3	0x0086d30D	16	 0	        O		
EthercatDevice_QECR00DF0D	0x00000bc3	0x0086d300	16	 0	        O		O
EthercatDevice_QECR00DF0H	0x00000bc3	0x0086d30B	16	 0	        O	O	
EthercatDevice_QECR00DT0L	0x00000bc3	0x0086d323	32	 0			
EthercatDevice_QECR00DT0H	0x00000bc3	0x0086d701	32	 0	        O	O	
EthercatDevice_QECR00D88S	0x00000bc3	0x0086d309	8	 8	        O		
EthercatDevice_QECR00D88D	0x00000bc3	0x0086d301	8	 8	        O		O
EthercatDevice_QECR00D88H	0x00000bc3	0x0086d30F	8	 8	        O	O	
EthercatDevice_QECR00DC4D	0x00000bc3	0x0086d304	12	 4	        O		O
EthercatDevice_QECR00D4CD	0x00000bc3	0x0086d302	4	 12	        O		O
EthercatDevice_QECR11D0FS	0x00000bc3	0x0086d0d4	0	 16	        O		
EthercatDevice_QECR11D0FH	0x00000bc3	0x0086d305	0	 16	        O	O	
EthercatDevice_QECR11D0TL	0x00000bc3	0x0086d324	0	 32			
EthercatDevice_QECR11D0TH	0x00000bc3	0x0086d800	0	 32	        O	O	
EthercatDevice_QECR11DF0S	0x00000bc3	0x0086d30E	16	 0	        O		
EthercatDevice_QECR11DF0D	0x00000bc3	0x0086d0d2	16	 0	        O		O
EthercatDevice_QECR11DF0H	0x00000bc3	0x0086d306	16	 0	        O	O	
EthercatDevice_QECR11DT0L	0x00000bc3	0x0086d320	32	 0			
EthercatDevice_QECR11DT0H	0x00000bc3	0x0086d700	32	 0	        O	O	
EthercatDevice_QECR11D88S	0x00000bc3	0x0086d0d5	8	 8	        O		
EthercatDevice_QECR11D88D	0x00000bc3	0x0086d307	8	 8	        O		O
EthercatDevice_QECR11D88H	0x00000bc3	0x0086d308	8	 8	        O	O	

Syntax

int attach(uint16_t slave_id, EthercatMaster *master, EthercatAttachMode mode = ECAT_SLAVE_NO);

int attach(uint16_t slave_id, EthercatMaster &master, EthercatAttachMode mode = ECAT_SLAVE_NO);

Parameters

  • [in] uint16_t slave_id
    The ID of the slave device on the EtherCAT bus. The definition of this ID is determined based on the mode parameter.
  • [in] EthercatMaster *master
    The object of EthercatMaster class to which it should be attached.
  • [in] EthercatAttachMode mode
    The definition of slave_id:
    • ECAT_SLAVE_NO
      The sequence number of the EtherCAT slave device on the network, 0 indicates the first slave device, 1 indicates the second slave device, and so on.
    • ECAT_ALIAS_ADDRESS
      The alias address of the slave device on the network, which is defined at byte offset 8 in the SII EEPROM of the slave device.

Return Value

Return an error code. If the returned value is zero, it indicates a successful execution of this function.

Comment

The function must be called after EthercatMaster::begin() and before EthercatMaster::start(). This function is blocking and cannot be called within the Cyclic Callback.

Example

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_QECR00D0FH slave;

void setup() {
    master.begin();
    slave.attach(0, master);
    master.start();
}
void loop() {

}

Please see EthercatDevice_DmpDIQ_Generic Class for more QEC DIO slave instructions and API usage.

Leave a Comment

Scroll to Top