Problem description
With the current version of mappMotion (now 5.24) you do not get a lot of information from the motion alarms.
Solution
Fortunately, the Backtrace functionality can be implemented with a little effort using the MpAlarmXListUI() function block. The result may look like this:
When you click on the line at the top, the Backtrace information is displayed at the bottom. This often consists of several records. The information displayed is very detailed. The same information can be found in Logger or mappCockpit.
How to
Code in PLC
A task similar to this needs to be added to the PLC:
PROGRAM _INIT
MpAlarmXCore_0.MpLink := ADR(gAlarmXCore);
MpAlarmXCore_0.Enable := TRUE;
MpAlarmXListUI_0.MpLink := ADR(gAlarmXCore);
MpAlarmXListUI_0.Enable := TRUE;
MpAlarmXListUI_0.UIConnect := ADR(MpAlarmXListUIConnect);
END_PROGRAM
PROGRAM _CYCLIC
// backtrace for motion alarms
IF MpAlarmXCore_0.PendingAlarms = 0 THEN
// No pending alarms, reset instance id
InstanceID := 0;
END_IF
maxIndex := SIZEOF(MpAlarmXListUIConnect.AlarmList.InstanceID) / SIZEOF(MpAlarmXListUIConnect.AlarmList.InstanceID[0]) - 1;
FOR i := 0 TO maxIndex DO
IF MpAlarmXListUIConnect.AlarmList.InstanceID[i] = InstanceID THEN
MpAlarmXListUIConnect.AlarmList.SelectedIndex := i;
EXIT;
END_IF
END_FOR
MpAlarmXCore_0();
MpAlarmXListUI_0();
END_PROGRAM
Variable definition:
VAR
MpAlarmXCore_0 : MpAlarmXCore;
MpAlarmXListUI_0 : MpAlarmXListUI;
MpAlarmXListUIConnect : MpAlarmXListUIConnectType;
InstanceID : UDINT;
maxIndex : INT;
i : INT;
END_VAR
Edit the visualization
When clicking on an error line in the AlarmList, write the error identifier into the InstanceID variable:
Backtrace information is displayed in a table. In the first column, we add the error number:
and in the second column we insert the error text: