描述
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_ON | 0 | Not ready to switch on. |
| CIA402_SWITCH_ON_DISABLED | 1 | Switch on disabled. |
| CIA402_READY_TO_SWITCH_ON | 2 | Ready to switch on. |
| CIA402_SWITCHED_ON | 3 | Switched on. |
| CIA402_OPERATION_ENABLED | 4 | Operation enabled. |
| CIA402_FAULT | 5 | Fault. |
| CIA402_FAULT_REACTION_ACTIVE | 6 | Fault reaction active. |
| CIA402_QUICK_STOP_ACTIVE | 7 | Quick stop active. |
If the return value is less than 0, it indicates an 錯誤代碼.
備註
This function must be called after a successful execution of 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);
}Please see the EtherCAT CiA 402 User Manual for more QEC EtherCAT instructions and API usage.