Synchronous Call For The Functions _Activateto And _Deactivateto - Siemens SIMOTION Function Manual

Motion control basic functions for modular machines
Hide thumbs Also See for SIMOTION:
Table of Contents

Advertisement

Activating and deactivating components and technology objects
5.4 Activating and deactivating technology objects
Example program for the asynchronous call for the _activateTo function
INTERFACE
END_INTERFACE
IMPLEMENTATION
PROGRAM backGround // Assigned to the BackgroundTask
END_PROGRAM
END_IMPLEMENTATION
5.4.1.3

Synchronous call for the functions _activateTo and _deactivateTo

The synchronous call is recommended for MotionTasks.
82
USEPACKAGE Cam;
PROGRAM backGround;
VAR_GLOBAL
bgrRequestActivate : DINT := 0;
bgrResultActivate
bgrToInstance
bgrReqActDeactMode : enumReqActDeactGetStateMode := REQUEST_TRUE;
bgrCommandId
bgrNextCommand
END_VAR
VAR
retVal : DINT := 0;
END_VAR
// ... Further instructions
IF ( 0 <> bgrRequestActivate ) THEN
retVal := _activateTo (
TO_Instance
reqActDeactGetStateMode := bgrReqActDeactMode,
commandId
nextCommand
CASE retVal OF
16#0000_0000: bgrRequestActivate := 0;
// Node successfully activated.
16#0000_7001: bgrReqActDeactMode := REQUEST_FALSE;
// Function started successfully
16#0000_7002: ; // Function running.
ELSE // Troubleshooting
bgrRequestActivate := 0;
END_CASE;
IF ( 0 = bgrRequestActivate ) THEN
// Function completed, prepare next call.
bgrReqActDeactMode := REQUEST_TRUE;
bgrResultActivate := retVal;
END_IF;
END_IF;
// ... Further instructions
: DINT := 0;
: posaxis;
: CommandIdType;
: enumNextCommandMode := IMMEDIATELY;
:= bgrToInstance,
:= bgrCommandId,
:= bgrNextCommand );
Basic Functions for Modular Machines
Function Manual, 04/2014

Advertisement

Table of Contents
loading

Table of Contents