Understanding The Scan Cycle Of The Cpu; Understanding The Basic Scan Cycle Of The Cpu 210 - Siemens Simatic S7-200 CPU 210 System Manual

Table of Contents

Advertisement

Basic Concepts for Programming the CPU 210
4.3

Understanding the Scan Cycle of the CPU 210

The basic operation of the CPU 210 is very simple:
The CPU reads the status of the inputs.
The program that is stored in the CPU uses the inputs to evaluate the control logic. As
the program runs, the CPU writes the data to the outputs.
The CPU 210 continuously executes your program. If your program uses the optional
hardware interrupt routine, the interrupt routine can run anytime after the CPU executes the
Enable Interrupt (ENI) instruction in the main program segment.

Understanding the Basic Scan Cycle of the CPU 210

The CPU 210 executes your program in a continuous, cyclical series of tasks called a scan.
As shown in Figure 4-4, the CPU 210 performs the following tasks during the scan cycle:
1. During the first scan (after power is turned on) only, the CPU 210 clears the outputs (Q),
bit memory (M) area, and the current values for the timers (T). The CPU 210 clears these
elements only during the first scan.
If a memory cartridge is not installed, the CPU 210 restores the current values for the four
counters.
2. The CPU 210 filters the inputs and updates the value of the analog adjustment
potentiometer (stored in SMW2). This delays the scan by approximately 15 ms.
3. The CPU 210 executes the user program. As the program writes values to the outputs,
the CPU 210 immediately updates the outputs.
4. The CPU 210 updates the time base for the 100 ms timers.
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). After the Enable
Interrupt (ENI) instruction in the main program segment has been executed, the CPU 210
executes the interrupt routine on the rising edge of I0.0. The CPU 210 can run the interrupt
routine any time within the scan cycle.
CPU Tasks
Clear the outputs.
Clear M memory.
Clear the current values for
the timers.
First Scan Only
Figure 4-4
Scan Cycle for the CPU 210
4-6
After the interrupt routine has been enabled, interrupt events can start
the interrupt routine at any time in the scan,
Read the filtered inputs.
Execute the program.
Update the analog
Write the outputs.
potentiometer value.
All Scans
S7-200 Programmable Controller, CPU 210
Update the time base
for the timers.
C79000-G7076-C235-01

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents