(* Register, if an error 1 occurs *) IF ErrId_1 = 0 THEN (* if error 1 was not registered *) UREGDFB(AREA:=N, (* N = 1..15 *) CLAS:=16#004A, (* error type *) SLEN:=0, (* length des ESTS fields, if used *) CTRL:=0, (* 0: without, 1: with acknowledgement *), UTXT:= Fehler_1_Text, (* STRING *) RSEL:=1, (* What should be replaced *) PIN:=0, (* <> 0: monitor pin in the case of reasons for error: monitoring *) VALPIN:=0, (* Expected value on monitored pin *) ESTS=>DfbStatus, (* error status *) ERID=>ErrId_1, (* error recognition *) STAT=>RegStatus); (* Status *) IF RegStatus = 0 THEN (* registration was successful *) ELSE (* if an error occurs *) END_IF;
(* update the system word %SW76 *) %SW76 := RegStatus; END_IF;
(* De-registration, if error 1 is possible *) IF ErrId_1 <> 0 THEN DeRegStatus:=DEREG(ErrId_1); (* De-registration of the error *) IF DeRegStatus = 0 THEN ErrId_1 := 0; (* reset the Error identification: *) END_IF;
(* Update of the system word %SW77 for operations which have been run *) %SW77:= DeRegStatus; END_IF;