[EtherCAT Device CiA402]
説明
Initialize the object of this EtherCAT SubDevice class and attach it to the object of EthercatMaster class based on the ID of the SubDevice on the network.
構文
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, uint8_t drive_id, EthercatMaster *master, EthercatAttachMode mode = ECAT_SLAVE_NO);
int attach(uint16_t slave_id, uint8_t drive_id, EthercatMaster &master, EthercatAttachMode mode = ECAT_SLAVE_NO);
媒介変数
[in] slave_id
The ID of the SubDevice on the EtherCAT bus. The definition of this ID is determined based on the mode parameter.[in] drive_id
The ID of CiA 402 drive in the EtherCAT SubDevice. Typically used when a single EtherCAT SubDevice has multiple CiA 402 drive axes.[in] master
The object of EthercatMaster class to which it should be attached.[in] mode
The definition of slave_id :- ECAT_SLAVE_NO
The sequence number of the EtherCAT SubDevice on the network, 0 indicates the first SubDevice, 1 indicates the second SubDevice, and so on. - ECAT_ALIAS_ADDRESS
The alias address of the SubDevice on the network, which is defined at byte offset 8 in the SII EEPROM of the SubDevice.
- ECAT_SLAVE_NO
戻り値
error codeを返します。返された値が 0の場合、この関数が正常に完了したことを示します。
備考
この関数は、 .
WARNING: Prohibited from being called in the callback functions.
例
Single-axis CiA 402 EtherCAT Servo Drive
#include "Ethercat.h"
EthercatMaster master;
EthercatDevice_CiA402 motor;
void setup() {
master.begin();
motor.attach(0, master);
}
void loop() {
// put your main code here, to run repeatedly:
}Multi-axis CiA 402 EtherCAT Servo Drive
#include "Ethercat.h"
EthercatMaster master;
EthercatDevice_CiA402 motor1;
EthercatDevice_CiA402 motor2;
EthercatDevice_CiA402 motor3;
void setup() {
master.begin();
motor1.attach(0, 0, master);
motor2.attach(0, 1, master);
motor3.attach(0, 2, master);
}
void loop() {
// put your main code here, to run repeatedly:
}詳細は EtherCAT CiA 402 User Manual QEC EtherCAT命令とAPI使用法参照