我想找...

搜尋

分享

目錄

EthercatDevice_DmpLCD.attach()

[EthercatDevice_DmpLCD_Generic]

描述

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. If the lcd_id parameter is provided, the lcdInit() function will be called to initialize the LCD module.

衍生類別:

Class NameVendor IDProduct Code
EthercatDevice_QECR11UN010x00000bc30x0086d103
EthercatDevice_QECR00UN010x00000bc30x0086d100

語法

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);
int attach(uint16_t slave_id, EthercatMaster *master, uint16_t lcd_id, EthercatAttachMode mode = ECAT_SLAVE_NO);
int attach(uint16_t slave_id, EthercatMaster &master, uint16_t lcd_id, EthercatAttachMode mode = ECAT_SLAVE_NO);

參數

  • [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:
    1. 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.
    2. 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.
  • [in] uint16_t lcd_id
    The ID of the LCD module to be initialized. For a list of supported LCD modules, please refer to lcdInit().

回傳值

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

備註

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

範例

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_QECR11UN01 slave;

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

void loop() {
  // ...
}

Please see EthercatDevice_DmpLCD_Generic 類別 for more QEC Stepper Drivers instructions and API usage.

返回頂端