Initialisation function UserInitialisations()
FUNCTION UserInitialisations : BOOL
VAR_INPUT
dummy : BOOL := FALSE; (* not_used *)
END_VAR
VAR
AxIdx : UDINT;
ChIdx : UDINT;
END_VAR
(* Register PLC at all axes interfaces *)
FOR AxIdx := 0 TO gNrAx - 1 DO
(* Set plc_present_w at each axis *)
gpAx[AxIdx]^.head.plc_present_w := TRUE;
(* Register at all axis specific control units you want to handle by PLC *)
(* Register at all control units to enable a drive *)
gpAx[AxIdx]^.lr_mc_control.torque_permission.enable_w := TRUE;
gpAx[AxIdx]^.lr_mc_control.release_feedhold.enable_w := TRUE;
gpAx[AxIdx]^.lr_mc_control.drive_on.enable_w := TRUE;
END_FOR;
(* Register PLC at all channel interfaces *)
FOR ChIdx := 0 TO gNrCh - 1 DO
(* Set plc_present_w at each channel *)
gpCh[ChIdx]^.head.plc_present_w := TRUE;
(* Register at all channel specific control units you want to handle by PLC *)
END_FOR;
UserInitialisations := TRUE;