Monitoring and operation
A PLC program must monitor the operating state of the drives and if necessary, put them in an error-free state, ready for operation. This state is attained if the following conditions are satisfied:
- The EtherCAT Master and all participating EtherCAT Slaves must be in the OPERATIONAL (OP) state.
- The drive devices must not be in an error state but must be ready for operation.
To satisfy the above-mentioned conditions, the PLC program must execute the following steps:
- IO (fieldbus):
Read the I/O device’s hardware address associated with the NC axis. - Read the address of the I/O device such as NetId, Port, ChannelNo, etc. by means of FB_GetAxisAmsAddr (TcNc-Lib).
(The data is required for EtherCAT function block). - IO (fieldbus):
Check the EtherCAT communication. - Monitor the EtherCAT Master state by means of FB_EcGetMasterState (TcEtherCAT-Lib).
- Monitor the EtherCAT Slave state by means of FB_EcGetSlaveState (TcEtherCAT-Lib).
- Change the EtherCAT Master state by means of FB_EcSetMasterState (TcEtherCAT-Lib).
- Change the EtherCAT Slave state by means of FB_EcSetSlaveState (TcEtherCAT-Lib).
- IO (fieldbus):
Optional evaluation of the EtherCAT WorkingCounter - Evaluation of the EtherCAT WorkingCounter by additional mapping from the I/O device to the PLC (cyclic communication)
- Drive:
Check the drive status regarding errors, warnings, and notices (Drive State Machine) - Read the current drive error F01 to F32 (see ASCII command ERRCODE) by means of PDO 0x2070 (SubIndex: 0x16, Data: UINT32)
- Read the current drive status, e.g., warnings n01 to n32 (see ASCII command STATCODE) by means of PDO 0x385E (SubIndex: 0x1, Data: UINT32)