Siemens SIMOTION Function Manual page 54

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

Advertisement

Setting the communication addresses via the user program
4.4 Setting the IP address (on Ethernet)
Example with _getPnIpConfig and _setPnIpConfig (as of V4.4, asynchronous call)
END_INTERFACE
IMPLEMENTATION
54
result_setIpConfig : UDINT;
ioId
logAddress
ip
mask
gate
storePermanent
nextCommand
commandId
END_STRUCT;
END_TYPE
VAR_GLOBAL
bgrStart
: BOOL
bgrState
: DINT
bgrI
: DINT
bgrPnIpConfig : pnIpConfigStruct;
END_VAR
PROGRAM bgr;
PROGRAM bgr
CASE bgrState OF
0:
IF bgrStart THEN
bgrState := 1000;
bgrStart := FALSE;
END_IF;
1000:
// Initialization
bgrPnIpConfig.ioId
bgrPnIpConfig.logAddress
bgrPnIpConfig.nextCommand := IMMEDIATELY;
bgrPnIpConfig.commandId
bgrPnIpConfig.result_getIpConfig.functionResult := 0;
bgrState := 1001;
1001:
// Call of _getPnIpConfig
bgrPnIpConfig.result_getIpConfig := _getPnIpConfig (
nextCommand
commandId
CASE bgrPnIpConfig.result_getIpConfig.functionResult OF
16#0000:
16#7001:
16#7002:
16#7003:
ELSE
END_CASE;
2000:
// Initialization
: EnumIoIdType;
: DINT;
: ARRAY [0..3] OF USINT;
: ARRAY [0..3] OF USINT;
: ARRAY [0..3] OF USINT;
: EnumYesNo;
: EnumNextCommandMode;
: commandIdType;
:= FALSE;
:= 0;
:= 0;
:= X150_PORT_1_LOG_ADDRESS; // 16378;
ioId
logicalAddressPnInterface := bgrPnIpConfig.logAddress,
// Function terminated successfully
bgrState := 2000;
; // Function started
; // Function active
; // Function aborted
// Error
bgrState := 10009;
:= INPUT;
:= _getCommandId ();
:= bgrPnIpConfig.ioId,
:= bgrPnIpConfig.nextCommand,
:= bgrPnIpConfig.commandId );
Basic Functions for Modular Machines
Function Manual, 04/2014

Advertisement

Table of Contents
loading

Table of Contents