EasyManuals Logo

Siemens Simatic S7 Series System Manual

Siemens Simatic S7 Series
726 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #347 background imageLoading...
Page #347 background image
Program instructions
7.18 Subroutine
S7-200 SMART
System Manual, 09/2015, A5E03822230-AC
347
Error conditions with ENO = 0
SM bits affected
0006H Indirect address
008H Maximum subroutine nesting
exceeded
None
Input / output
Data type
Operand
SBR_n
WORD
Constant: 0-127
IN
BOOL
V, I, Q, M, SM, S, T, C, L, Power Flow (LAD), Logic flow (FBD)
BYTE VB, IB, QB, MB, SMB, SB, LB, AC, *VD, *LD, *AC
1
, Constant
WORD, INT
VW, T, C, IW, QW, MW, SMW, SW, LW, AC, AIW, *VD, *LD, *AC
1
, Constant
DWORD, DINT VD, ID, QD, MD, SMD, SD, LD, AC, HC, *VD, *LD, *AC
1
, &VB, &IB, &QB, &MB,
&T, &C, &SB, &AI, &AQ, &SMB, Constant
STRING
*VD, *LD, *AC
1
, Constant
IN_OUT
BOOL
V, I, Q, M, SM
2
, S, T, C, L
BYTE
VB, IB, QB, MB, SMB
2
, SB, LB, AC, *VD, *LD, *AC
1
WORD, INT
VW, T, C, IW, QW, MW, SMW
2
, SW, LW, AC, *VD, *LD, *AC
1
DWORD, DINT
VD, ID, QD, MD, SMD
2
, SD, LD, AC, *VD, *LD, *AC
1
OUT
BOOL
V, I, Q, M, SM
2
, S, T, C, L
BYTE
VB, IB, QB, MB, SMB
2
, SB, LB, AC, *VD, *LD, *AC
1
WORD, INT
VW, T, C, IW, QW, MW, SMW
2
, SW, LW, AC, AQW, *VD, *LD, *AC
1
DWORD, DINT
VD, ID, QD, MD, SMD
2
, SD, LD, AC, *VD, *LD, *AC
1
1
Only AC1, AC2 or AC3 (AC0 not allowed)
2
Must be from byte offset 30 to byte offset 999 for read/write access
Calling a subroutine with call parameters
Subroutines have the option of using passed parameters. The parameters are defined in the
variable table of the subroutine. Each parameter must be assigned a local symbol name (a
maximum of 23 characters), a variable type, and a data type. A maximum of sixteen
parameters can be passed to or from a subroutine. The VAR_Type type field in the 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).
To add a new parameter row, place the cursor on the Var_Type field of the type (IN,
IN_OUT, OUT, or TEMP) 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 row of
the selected type will appear below the current entry.
Temporary (TEMP) parameters can be assigned in the variable table to store data that is
valid only within the scope of the subroutine execution. Local TEMP data is not passed as a
call parameter. You can also assign TEMP parameters in the main routine and interrupt
routines, but only subroutines can use IN, IN_OUT, and OUT call parameters.

Table of Contents

Other manuals for Siemens Simatic S7 Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Siemens Simatic S7 Series and is the answer not in the manual?

Siemens Simatic S7 Series Specifications

General IconGeneral
CPUVaries by model (e.g., S7-300, S7-400, S7-1200, S7-1500)
Communication InterfacesPROFIBUS, PROFINET, Ethernet, MPI
ProgrammingTIA Portal, STEP 7
Programming LanguagesLAD, FBD, STL, SCL, GRAPH
I/O ModulesDigital, Analog, Specialty modules available
Operating Temperature0°C to 60°C (standard models)
MountingDIN rail mounting
Operating Voltage24V DC or 120/230V AC (varies by model)
Protection ClassIP20 (standard models)
MemoryVaries depending on the S7 model. Includes work memory (RAM) for program execution, load memory (EEPROM or Flash) for program storage, and system memory for operating system functions. Memory sizes range from kilobytes to megabytes.

Related product manuals