ItpLoadProgEx

from library version 6.1.21 and TwinCAT version 2.10 Build 1304

ItpLoadProgEx 1:

Interface

VAR_INPUT
bExecute       : BOOL;
sPrg           : STRING;
nLength        : UDINT;
tTimeOut       : TIME;
END_VAR
VAR_IN_OUT
sNciToPlc      : NciChannelToPlc;
END_VAR

NciChannelToPlc

VAR_OUTPUT
bBusy          : BOOL;
bErr           : BOOL;
nErrId         : UDINT;
END_VAR

Description

On a rising edge at the bExecute input, the block loads the NC program whose name is given at the sPrg input. The string length of the program name is provided at the nLength input.

The NC program is sought in the “TwinCAT\cnc” directory if no other information is provided. It is however also possible to give an absolute path.

The bBusy output remains TRUE until the block has executed a command, although only for as long as the time specified at the tTimeOut input. While bBusy = TRUE, no new instruction will be accepted at the inputs.
The output bErr goes TRUE if an error occurs as the command is being executed. The command-specific error code is contained in nErrId. The outputs are reset by carrying out a command at the inputs.

Sample

VAR
in_stItpToPlc AT %I*         : NciChannelToPlc;
fbLoadProg                   : ItpLoadProgEx;
sProgramPath                 : STRING (255):= 'TestIt.nc';
END_VAR
fbLoadProg(
bExecute := TRUE,
sPrg := sProgramPath,
nLength := LEN(sProgramPath),
tTimeOut := t#200ms,
sNciToPlc := in_stItpToPlc
);

Requirements

Development Environment

Target System Type

PLC Libraries to include

TwinCAT v2.10.0

PC (i386)

TcNci.lib