getCiA402State()

説明

Get the current CiA 402 state.

Relevant Objects

  • Object 6041h: Statusword

構文

int getCiA402State();

媒介変数

なし

戻り値

Return the current CiA 402 state:

定義コードState
CIA402_NOT_READY_TO_SWITCH_ON0Not ready to switch on.
CIA402_SWITCH_ON_DISABLED1Switch on disabled.
CIA402_READY_TO_SWITCH_ON2Ready to switch on.
CIA402_SWITCHED_ON3Switched on.
CIA402_OPERATION_ENABLED4Operation enabled.
CIA402_FAULT5Fault.
CIA402_FAULT_REACTION_ACTIVE6Fault reaction active.
CIA402_QUICK_STOP_ACTIVE7Quick stop active.

戻り値が0未満の場合、 error codeを示します。.

備考

この関数は、 EthercatMaster::start(). This function is non-blocking and can be called in callback functions.

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_CiA402 motor;

void setup() 
  { Serial.begin(115200);
   while (!Serial);
   
   master.begin();
   motor.attach(0, master);
   master.start();
}

void loop() {
  Serial.print("CiA402 State: "); 
  Serial.println(motor.getCiA402State()); 
  delay(1000);
}

詳細は EtherCAT CiA 402 User Manual QEC EtherCAT命令とAPI使用法参照

上部へスクロール