PLC main program frame

Programing Example

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 ended successfully and if

   errors occurred during initialisation phase. *)

IF Hli.Initialised = 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 initialisation *)

    UserInitialisationDone := UserInitialisations(dummy:=TRUE);

  END_IF;

  (* --------------------------------------------------- *)

  (* Insert your PLC application code after this comment *)

  (* --------------------------------------------------- *)

  IF Hli.Error = TRUE THEN

    (* Error on initialisation of the HLI *)

    (* iErrorId contains error number *)

    HliInitError := TRUE;

  END_IF;

END_IF;