Search code examples
motiontwincatcncindustrialtwincat-ads

How to Solve Error 0x4260: Controller Enable Signal Lost in Axis, StateDWord 0x21a1301 in beckhoff twincat3 NC-PTP Motion?


The beckhoff Twincat system is connected to two axes via the Ethercat bus. Axis 1 and Axis 2 are running at 2000 degrees per second and 300 degrees per second,just using MC_MoveVelocity Function Block; respectively, and the following error is reported after approximately 1 hour and 20 minutes of operation:

enter image description here

Error 2023/10/23 11:33:55 169 ms | 'TCNC' (500): 'Axis 2' (Axis-ID: 2, Grp-ID: 2): The axis or a coupled slave axis has lost its controller enable signal while executing a command => error 0x4260 (StateDWord: 0x21a1301, CoupleState: 0, ActPos: 1525883.866652, ActVelo: 299.993040) Severity Code Description Project File Line Suppression State Error 2023/10/23 11:33:55 169 ms | 'TCNC' (500): 'Axis 1' (Axis-ID: 1, Grp-ID: 1): The axis or a coupled slave axis has lost its controller enable signal while executing a command => error 0x4260 (StateDWord: 0x21a1301, CoupleState: 0, ActPos: 10371623.101616, ActVelo: 1999.996639)

After consulting the Twincat NC error documentation, the following was found: text 4260 16992 Monitoring "Controller enable" Controller enable for the axis or for a coupled slave axis is not present (see axis interface PlcToNc). This error occurs if the controller enable is withdrawn while an axis or a group of axes (also a master/slave group) is being actively positioned. The error also occurs if a PTP axis or a coupled slave axis is started without controller enable.

I have checked the Twincat3 PLC code, and through online SCOPE monitoring, I found that the BOOL variable Enable in the MC_POWER function block is always TRUE, until the fault occurs, the variable is always TRUE.

enter image description here


Solution

  • The problem is that at high rotation speeds, the value of GVL.Axis_Pos_WithRefZero_WithRepair_BeforeRounding[i] will be very large, which will cause the calculation of GVL.Axis_Pos_WithRefZero_WithRepair_AfterRounding[i] consume a lot of CPU resources when calculating GVL. my code uses multiple functions (e.g. ConvertRangeTo360, ConvertRangeTo240, etc.) to limit the angle values to a specific range. These functions use a loop structure, and if the input angle value is very large, then the function needs to execute a large number of loops, which can consume a lot of CPU resources.