Siemens 6AV6651-7KA01-3AA4 - S7-1200 + KTP400 Basic Starter Kit 6AV6651-7KA01-3AA4 用户手册

产品代码
6AV6651-7KA01-3AA4
下载
页码 364
Programming made easy 
 
6.1 Easy to design your user program 
 
Easy Book 
90
 
Manual, 03/2014, A5E02486774-AF 
Creating additional OBs 
You can create multiple OBs for your user program, even for the program cycle and startup 
OB events. Use the "Add new block" dialog to create an OB and enter a name for your OB.  
If you create multiple program cycle OBs for your user program, the CPU executes each 
program cycle OB in numerical sequence, starting with the program cycle OB with the lowest 
number (such as OB 1). For example: after the first program cycle OB (such as OB 1) 
finishes, the CPU executes the program cycle OB with the next higher number.  
Configuring the properties of an OB 
 
 
You can modify the properties of an 
OB. For example, you can configure the 
OB number or programming language.  
 
 
 
Note 
Note that you can assign a process image part number to an OB that corresponds to PIP0, 
PIP1, PIP2, PIP3, or PIP4. If you enter a number for the process image part number, the 
CPU creates that process image partition. See the topic "Execution of the user program 
(Page 53)" for an explanation of the process image partitions. 
 
6.1.2 
FBs and FCs make programming the modular tasks easy 
A function (FC) is like a subroutine. An FC is a code block that typically performs a specific 
operation on a set of input values. The FC stores the results of this operation in memory 
locations. Use FCs to perform the following tasks:  
●  To perform standard and reusable operations, such as for mathematical calculations 
●  To perform functional tasks, such as for individual controls using bit logic operations 
An FC can also be called several times at different points in a program. This reuse simplifies 
the programming of frequently recurring tasks. 
Unlike an FB, an FC does not have an associated instance DB. The FC uses its temp 
memory (L) for the data used to calculate the operation. The temporary data is not saved. To 
store data for use after the execution of the FC has finished, assign the output value to a 
global memory location, such as M memory or to a global DB.