Basic Elements For Constructing A Program; Organizing The Program; Example Program Using Subroutines And Interrupts - Siemens SIMATIC S7-200 System Manual

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

Advertisement

Basic Concepts for Programming an S7-200 CPU
4.5

Basic Elements for Constructing a Program

The S7-200 CPU continuously executes your program to control a task or process.
You create this program with STEP 7-Micro/WIN 32 and download it to the CPU.
From the main program, you can call different subroutines or interrupt routines.

Organizing the Program

Programs for an S7-200 CPU are constructed from three basic elements: the main
program, subroutines (optional), and interrupt routines (optional). An S7-200
program is structured into the following organizational elements:
Main program: The main body of the program is where you place the
instructions that control your application. The instructions in the main program
are executed sequentially, once per scan of the CPU.
Interrupt routines: These optional elements of your program are executed on
each occurrence of the interrupt event.
Subroutines: These optional elements of your program are executed only when
they are called from the main program or an interrupt routine.

Example Program Using Subroutines and Interrupts

Following are sample programs for a timed interrupt that can be used for
applications such as reading the value of an analog input. In this example, the
sample rate of the analog input is set to 100 ms.
Figure 4-7 through Figure 4-11 show programs for using a subroutine and an
interrupt routine for the various S7-200 programming languages.
4-18
S7-200 Programmable Controller System Manual
A5E00066097-02

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents