Organizing The Program - Siemens Simatic S7-200 CPU 210 System Manual

Table of Contents

Advertisement

Organizing the Program

As shown in Figure 4-3, a program for the CPU 210 is structured into the following
organizational elements: the main program and an optional hardware interrupt routine.
The main program stores the instructions that control your application. The instructions in
the main program are executed sequentially once per scan of the CPU. To terminate the
main program, use an Unconditional End coil in ladder or a main program end instruction
(MEND) in STL.
The CPU 210 also allows one optional hardware interrupt routine. If you use the interrupt
routine in your program, the CPU executes these instructions on a specific hardware
event (the rising edge when I0.0 turns on). Place the interrupt routine after the end of
the main program (following the Unconditional End (MEND) instruction). Use a Return
From Interrupt (RETI) instruction to terminate the interrupt routine.
Section 4.6 provides an example of a program using an interrupt routine. The interrupt
routine is not executed as part of the normal scan cycle, but is executed when the
interrupt event occurs (which may be at any point in the scan cycle).
For additional information about designing and entering a program, see the sample
application in Chapter 3.
User Program
Figure 4-3
Program Structure for the CPU 210
S7-200 Programmable Controller, CPU 210
C79000-G7076-C235-01
Basic Concepts for Programming the CPU 210
Main Program
.
.
.
MEND
Interrupt Routine (optional)
RETI
Main Program:
Executed once per scan
Interrupt Routine:
Executed on each occurrence of the
interrupt event
4-5

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents