Calling A Subroutine With Parameters; Step 7-Micro/Win 32 Local Variable Table - Siemens SIMATIC S7-200 System Manual

Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

SIMATIC Instructions

Calling a Subroutine With Parameters

Subroutines may contain passed parameters. The parameters are defined in the
local variable table of the subroutine (Figure 9-53). The parameters must have a
symbol name (maximum of 8 characters), a variable type, and a data type. Sixteen
parameters can be passed to or from a subroutine.
The variable type field in the local variable table defines whether the variable is
passed into the subroutine (IN), passed into and out of the subroutine (IN_OUT),
or passed out of the subroutine (OUT). The characteristics of the parameter types
are as follows:
IN: parameters are passed into the subroutine. If the parameter is a direct
address (such as VB10), the value at the specified location is passed into the
subroutine. If the parameter is an indirect address (such as *AC1), the value at
the location pointed to is passed into the subroutine. If the parameter is a data
constant (16#1234), or an address (VB100), the constant or address value is
passed into the subroutine.
IN_OUT: the value at the specified parameter location is passed into the
subroutine and the result value from the subroutine is returned to the same
location. Constants (such as 16#1234) and addresses (such as &VB100) are
not allowed for input/output parameters.
OUT: The result value from the subroutine is returned to the specified
parameter location. Constants (such as 16#1234) and addresses (such as
&VB100) are not allowed as output.
TEMP:
Any local memory that is not used for passed parameters may be used for
temporary storage within the subroutine.
To add a parameter entry, place the cursor on the variable type field of the type
(IN, IN_OUT<OUT) that you want to add. Click the right mouse button to get a
menu of options. Select the Insert option and then the Row Below option. Another
parameter entry of the selected type appears below the current entry.
Name
EN
L0.0
IN1
IN2
LB1
IN3
LB2.0
IN4
LD3
IN/OUT1
LW7
LD9
OUT1
Figure 9-53
9-150
Var. Type
IN
IN
IN
IN
IN
IN_OUT
OUT
TEMP

STEP 7-Micro/WIN 32 Local Variable Table

Data Type
Comment
BOOL
BOOL
BYTE
BOOL
DWORD
WORD
DWORD
S7-200 Programmable Controller System Manual
A5E00066097-02

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents