PLC example

Integrating the structure in a 3S PLC program:

VAR
  (* Use generated structure descriptions *)
  p_ve_chan_1 : POINTER TO VE_CHANNEL_DATA_CH_1;
  p_ve_glob   : POINTER TO VE_GLOBAL_DATA_FROM_CH_1;
  text        : STRING(20);
  init_ve_ptr : BOOL := TRUE;
END_VAR
(* Ensure that the internal management data is initialised *)
Hli(Start := TRUE);
IF Hli.Initialised = TRUE AND Hli.Error = FALSE THEN
  IF init_ve_ptr = TRUE THEN
    (* Provide pointer to structure(s) *)
    p_ve_chan_1 := ADR( gpVECH[0]^.ext_var32[0]);
    p_ve_glob   := ADR(gpVEGlobal^.ext_var32[0]);
  END_IF;
  (* Work with the variables (read, write) *)
  text := p_ve_chan_1^.TEXT[0].token;
  p_ve_chan_1^.FARBE[1] := 2;
END_IF