NT_StartProcess

NT_StartProcess 1:

The function block NT_StartProcess can be used to start a Windows application from the PLC. The function block can also be used to run applications on a remote PC.

NT_StartProcess 2: Inputs

VAR_INPUT
    NETID     : T_AmsNetId;
    PATHSTR   : T_MaxString;
    DIRNAME   : T_MaxString;
    COMNDLINE : T_MaxString;
    START     : BOOL;
    TMOUT     : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR

Name

Type

Description

NETID

T_AmsNetID

The network address of the TwinCAT computer on which the application is to be started can be specified here. For the local computer an empty string may be specified.

PATHSTR

T_MaxString

The full path to the application that is to be run, in the form of a string (e.g. "C:\WINNT\NOTEPAD.EXE" ).

DIRNAME

T_MaxString

Working directory of the application to be executed as a string (e.g.: "C:\WINNT").

COMNDLINE

T_MaxString

Command line parameters (e.g.: "win.ini").

START

BOOL

The function block is enabled by a positive edge at this input.

TMOUT

TIME

Time-out period that may not be exceeded when executing the ADS command.

NT_StartProcess 3: Outputs

VAR_OUTPUT
    BUSY         : BOOL;
    ERR          : BOOL;
    ERRID        : UDINT;
END_VAR

Name

Type

Description

BUSY

BOOL

When the function block is enabled, this output is set and remains set until a feedback is received.

ERR

BOOL

If an error should occur during the transfer of the command, then this output is set once the BUSY output was reset.

ERRID

ADS error number,
Win32 error code (Platform SDK: Win32 API).

Returns the error code, if the ERR output is set.

Example:

NT_StartProcess1      : NT_StartProcess;
NT_StartProcess_Busy  : BOOL;
NT_StartProcess_Err   : BOOL;
NT_StartProcess_ErrId : UDINT;
StartProcess          : BOOL;
Tmout                 : TIME;
NT_StartProcess 4:

Requirements

Development environment

Target platform

PLC libraries to be integrated (category group)

TwinCAT v3.1.0

PC or CX (WES7/Win7/Win10: TC RT x86/x64, WEC6/7: TC RT x86, WEC7: TC CE7 ARMV7, TC/BSD: TC RT x64)

Tc2_Utilities (System)