Blog

Beckhoff Drive Diagnostics

Beckhoff Drive Diagnostics

Recently, I was working with a client that was using TwinCAT 3 and Beckhoff drives to control machinery. One night, as they were running this machine, the drive faulted. Without any diagnostic message visible on the HMI, they were completely in the dark as to why the drive failed.

Typically, as a programmer, I'll diagnose this by opening up Drive Manager and taking a look at the diagnostic message.

 

 

As this is useful information for an operator to see, this led me to implement a Beckhoff function block that would output the drive diagnostic message as a string.

The FB_SoEReadDiagMessage function block requires 3 inputs:

  1. Axis Reference
  2. Execute Bit
  3. Timeout

Whenever the execute bit goes high, the function block is run. The outputs include a variety of different information, but the one we're most interested in is the DiagMessage output. Within the DiagMessage, you can pick the max size, actual size, or strData. What we really want to see is the strData, which will hold the diagnostic message of the drive. By placing this string into a variable accesible from the HMI, you can display this string for any operator or customer to see. 

Overall, this is a great method to help clients maintain and troubleshoot their drives. For implementing this function block, some sample code is below: 



IF bDiagMessage THEN
    fbDiagMessage(
        Axis := gDevices.Guide_Roll_Axis,
        Execute := TRUE,
        Timeout := T#5S,
        DiagMessage => DiagMessage);
    IF NOT fbDiagMessage.Busy THEN
        fbDiagMessage(Axis := gDevices.Guide_Roll_Axis, Execute := FALSE);
        bDiagMessage := FALSE;
    END_IF
END_IF
gHmi.GuideRoll.sAxisStatus := DiagMessage.strData;

Learn more about DMC's Beckhoff and TwinCAT 3 programming services.

Comments

There are currently no comments, be the first to post one.

Post a comment

Name (required)

Email (required)

CAPTCHA image
Enter the code shown above: