Siemens SIMOTION Function Manual page 51

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

Advertisement

Example with _getPnPortNeighbour, _getPnNameOfStation, _setPnNameOfStation (as of V4.4,
asynchronous call)
END_IMPLEMENTATION
Example with _getActiveNameOfStation, _setNameOfStation, _activateNameOfStation (up to V4.3,
synchronous call)
// Program assigned to a MotionTask
// Variable declaration
VAR
END_VAR
// Read active device name
retNameOfStation := _getActiveNameOfStation (
IF (0 = retNameOfStation.functionResult) THEN
END_IF;
IF (1 = neededSetNameOfStation) THEN
Basic Functions for Modular Machines
Function Manual, 04/2014
4.3 Setting the device name (NameOfStation) of an IO device on PROFINET IO
16#7002:
16#7003:
ELSE
END_CASE;
ELSE
; // Error handling
END_CASE;
END_PROGRAM
// Diagnostics address of the PROFINET IO interface
logAddrPnAdapter : DINT := 1023;
// Device name of the PROFINET IO interface
locNameOfStation : STRING[240];
// Variables for the return values
retNameOfStation : StructRetDeviceNameOfStation;
locRetVal : DINT;
neededSetNameOfStation : DINT := 0;
locCommandId : CommandIdType;
logicalAddressPnInterface := logAddrPnAdapter,
// Diagnostics address of the PROFINET IO interface
requestMode := REQUEST_TRUE,
// Function will be executed
commandId := locCommandId,
nextCommand := WHEN_COMMAND_DONE
// Synchronous call; wait until the function has terminated
);
// Check if new device name is necessary
IF (retNameOfStation.nameOfStation <> locNameOfStation) THEN
// Need to create a new device name
neededSetNameOfStation := 1;
ELSE
; // User-defined error response
END_IF;
// Set new device name
locRetVal := _setNameOfStation (
logicalAddressPnInterface := logAddrPnAdapter,
// Diagnostics address of the PROFINET IO interface
nameOfStation := locNameOfStation,
Setting the communication addresses via the user program
; // Function active
; // Function aborted
// Error
bgrNameState := 30009;
51

Advertisement

Table of Contents
loading

Table of Contents