Siemens 6AV6651-7KA01-3AA4 - S7-1200 + KTP400 Basic Starter Kit 6AV6651-7KA01-3AA4 Manuel D’Utilisation

Codes de produits
6AV6651-7KA01-3AA4
Page de 364
 
Easy Book 
Manual, 03/2014, A5E02486774-AF 
87
 
 
Programming made easy 
6.1 
Easy to design your user program 
When you create a user program for the automation tasks, you insert the instructions for the 
program into code blocks (OB, FB, or FC).  
Choosing the type of structure for your user program 
Based on the requirements of your application, you can choose either a linear structure or a 
modular structure for creating your user program.  
●  A linear program executes all of the instructions for your automation tasks in sequence, 
one after the other. Typically, the linear program puts all of the program instructions into 
one program cycle OB (such as OB 1) for cyclic execution of the program.  
●  A modular program calls specific code blocks that perform specific tasks. To create a 
modular structure, you divide the complex automation task into smaller subordinate tasks 
that correspond to the functional tasks being performed by the process. Each code block 
provides the program segment for each subordinate task. You structure your program by 
calling one of the code blocks from another block.  
 
Linear structure: 
Modular structure: 
 
 
 
 
By designing FBs and FCs to perform generic tasks, you create modular code blocks. You 
then structure your user program by having other code blocks call these reusable modules. 
The calling block passes device-specific parameters to the called block. When a code block 
calls another code block, the CPU executes the program code in the called block. After 
execution of the called block is complete, the CPU resumes the execution of the calling 
block. Processing continues with execution of the instruction that follows after the block call.  
You can also assign an OB to an interrupting event. When the event occurs, the CPU 
executes the program code in the associated OB. After the execution of the OB is complete, 
the CPU resumes the execution at the point in the user program when the interrupting event 
occurred, which could be any point in the scan.