Integrating into PLC program
VAR_GLOBAL
p_ve_global : POINTER TO VE_GLOBAL_DATA_FROM_CH_1;
p_ve_channel: POINTER TO VE_CHANNEL_DATA_CH_1;
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 := ADR(gpVECH[0]^.ext_var32[0]);
p_ve_glob := ADR(gpVEGlobal^.ext_var32[0]);
END_IF;
(* Transfer variable sensor values *)
p_ve_global^.sensor := LREAL_TO_DINT(vz_sensor * SENSOR_ENCODER_OUT);
END_IF