PLC-Hauptprogrammrahmen

Programmierbeispiel

prg_example

MCV HLI-Interface

PROGRAM MAIN

VAR

  Hli                     : MCV_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();

(* Check if initialisation of HLI finished successful and if

   errors occured during initialization phase. *)

IF Hli.Initialized = TRUE AND Hli.Error = FALSE

THEN

  (* Do the initialisation 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.Error = TRUE THEN

    (* Fehler beim Initialisieren des HLI *)

    (* iErrorId enthaelt Fehlernummer *)

    HliInitError := TRUE;

  END_IF;

END_IF;