Creating MpAlarmX

Servus,
i’d the same issues moving from VC4 to MpAlarmX, to get rid of creating each Set/Reset FUB Instance I put it into a custom Library FUB, so i “just” have to create an FUB-Instance for each alarm.

Interface is just
MpLink to AlarmX
sInAlarmName : Name of the Alarm
bInAlarmSignal: Signal that activates the Alarm.

The generated AlarmID is stored in the FUB Instance

Here is the q&d impementation

FUNCTION_BLOCK FUB_AlarmSimple
  //Simple Alarm with automatic Reset
  //Alarms to be defined with
  // Multinstance - FALSE
  // Acknowledge - Requiered
  // Autoreset - False
  IF bInAlarmSignal THEN
    IF (udAlId = 0) THEN
			udAlId := MpAlarmXSet (MpLink, sInAlName);
		END_IF
	ELSIF (udAlId > 0) THEN
		MpAlarmXResetID (MpLink, udAlId);
		udAlId := 0;
	END_IF   
END_FUNCTION_BLOCK

The Alarm is callled like here

  FUBs.Alarm_EStopPanel.MpLink := gMpAlarmXCore;
  FUBs.Alarm_EStopPanel.sInAlName := 'EStopPanel';
  FUBs.Alarm_EStopPanel.bInAlarmSignal := NOT gbSInStopButtonPanel
  FUBs.Alarm_EStopPanel ();

I hope this helps
regards Michi

8 Likes