[EthercatDevice_DmpStepper_Generic]
描述
Enable the software limit function for the machine on the EtherCAT slave device. For more information about software limits, please refer to configMachineSoftLimit()
.
衍生類別:
Class Name | Vendor ID | Product Code |
EthercatDevice_QECR11MP3S | 0x00000bc3 | 0x0086d0d6 |
EthercatDevice_QECR00MP3S | 0x00000bc3 | 0x0086d0d9 |
語法
int machineEnableSoftLimit();
參數
無
回傳值
Return an error code. If the returned value is zero, it indicates a successful execution of this function.
備註
This function must be called after a successful execution of EthercatMaster::start()
and before EthercatMaster::stop()
. This function is blocking and cannot be called within the callback functions.
This function only works in G-code Controller mode on the EtherCAT slave device. For more details, please refer to configDeviceMode()
. This function does not work in the following case:
- The machine is servo-off.
範例
#include "Ethercat.h" EthercatMaster master; EthercatDevice_QECR11MP3S slave; void CyclicCallback() { slave.update(); } void setup() { Serial.begin(115200); master.begin(); slave.attach(0, master); slave.configMachineSoftLimit(ECAT_MACHINE_X_AXIS, -50, 50); slave.configMachineSoftLimit(ECAT_MACHINE_Y_AXIS, -50, 50); slave.configMachineSoftLimit(ECAT_MACHINE_Z_AXIS, -50, 50); master.attachCyclicCallback(CyclicCallback); master.start(); slave.machineServoOn(); while (slave.machineIsServoOn() == 0); slave.machineEnableSoftLimit(); slave.machineGcode("G1 X-100 Y-100 Z-100"); slave.machineGcode("G1 X100 Y100 Z100"); delay(10); while (slave.machineIsMoving()) { Serial.print("Acutal Position => "); Serial.print("X: "); Serial.print(slave.machineActualPosition(ECAT_MACHINE_X_AXIS), 2); Serial.print(", Y: "); Serial.print(slave.machineActualPosition(ECAT_MACHINE_Y_AXIS), 2); Serial.print(", Z: "); Serial.println(slave.machineActualPosition(ECAT_MACHINE_Z_AXIS), 2); delay(10); // ... } slave.machineServoOff(); while (slave.machineIsServoOn() == 1); } void loop() { // ... }
Please see EthercatDevice_DmpStepper_Generic 類別 for more QEC Stepper Drivers instructions and API usage.