disable()

Description

Disable the drive function and power off the motor. The behavior of this function is identical to

setCiA402State(CIA402_SWITCH_ON_DISABLED).

Relevant Objects

  • Object 6040h: Controlword
  • Object 6041h: Statusword

Syntax

int disable(uint32_t timeout_ms = 1000);

Parameters

  • [in] timeout_ms

Timeout in milliseconds.

Return Value

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

Comment

This function must be called after a successful execution of EthercatMaster::start(). This function is blocking and will wait for the actual value to match the set value until a timeout occurs. When used in a callback function, it becomes non-blocking and will ignore the timeout parameter, not waiting for the actual value to match the set value.

Example Code

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_CiA402 motor;

void setup() {
  master.begin(); 
  motor.attach(0, master); 
  master.start();
  
  motor.enable(); 
  delay(4000);
  motor.disable(); 
}

void loop() { 
  // put your main code here, to run repeatedly: 
}

Please see the EtherCAT CiA 402 User Manual for more QEC EtherCAT instructions and API usage.

Scroll to Top