PLC-Hauptprogrammrahmen

PLC-Hauptprogrammrahmen

PROGRAM MAIN
  VAR
    Hli : ISG_HliInterface;
    HliInitError : BOOL := FALSE; (* Error at initialisation of HLI *)
    UserInitialisationDone : BOOL := FALSE; (* User initialisation done *)
  END_VAR
(* Request description of the HLI from the CNC *)
Hli(bStart := TRUE);
(* Check if initialization of HLI finished successful and if
errors occured during initialization phase. *)
IF Hli.bInitialized = TRUEAND Hli.bError = FALSE THEN
  (* Do the initialization we do once the PLC starts up. *)
    IF UserInitialisationDone = FALSE THEN
       (* Get the result of the user defined initialization *)
       UserInitialisationDone := UserInitialisations(dummy:=TRUE);
    END_IF;
    (* --------------------------------------------------- *)
    (* Insert your PLC application code after this comment *)
    (* --------------------------------------------------- *)
    IF Hli.bError = TRUE THEN
      (* Fehler beim Initialisieren des HLI *)
      (* iErrorId enthaelt Fehlernummer *)
      HliInitError := TRUE;
    END_IF;
END_IF;