Beruflich Dokumente
Kultur Dokumente
Scan Cycle The cyclical operation of the CPU consists of three main sections, as shown in the
diagram above:
• The CPU checks the status of the input signals and updates the process-
image input table.
• It writes the values from the process-image output table into the output
modules.
PII The process-image input table is found in the CPU‘s memory area. The signal state
of all inputs is stored there.
PIQ Th process-image
The i output
t t table
t bl contains
t i th
the output
t t values
l that
th t resultlt from
f the
th
program execution. These are sent to the actual outputs (Q) at the end of the cycle.
User Program When you check inputs in the user program with, for example, A I 2.0, the last state
from the PII is evaluated. This guarantees that the same signal state is always
delivered when there is multiple checking of the input within one cycle.
Partitioned The program is divided into blocks, whereby every block only contains the
Program program for solving a partial task. Further partitioning through networks is possible
within a block. You can generate network templates for networks of the same type.
The organization
Th i ti blblock
k OB 1 contains
t i iinstructions
t ti th
thatt callll th
the other
th blocks
bl k iin a
defined sequence.
System Blocks System blocks are pre-defined functions or function blocks that are integrated in the
CPU‘s operating system. These blocks do not occupy additional space in the user
memory.
System blocks are called from the user program. These blocks have the same
interface the same identifier and the same number throughout the entire system
interface, system.
The user program is thus easily transportable between various CPUs or
programmable controllers.
Symbols In LAD, a symbol with the name "NO contact" is used for checking for signal state
"1" and a symbol with the name "NC contact" to check for signal state "0".
It makes no difference whether the process signal “1”
1 is supplied by an activated
NO contact or a non-activated NC contact.
Example The result of check for the "NO contact" symbol is "1" if an NC contact in the
machine is not activated.
Note ! The terms "NO contact" and "NC contact" have different meanings depending on
whether they are used in the process hardware context or as symbols in the
software.
Slot 3 Logically reserved for an interface module (IM) for multi-tier configurations using
expansion racks. Even if no IM is installed, it must be included for addressing
purposes.
You can physically reserve the slot (e.g. for installation of an IM at a later date) by
inserting a DM370 dummy module.
Slots 4-11 Slot 4 is the first slot that can be used for I/O modules, communications processors
((CP)) or function modules ((FM). )
Addressing examples:
• A DI module in slot 4 begins with the byte address 0 .
• The top LED of a DO module in slot 6 is called Q8.0 .
Note 4 byte addresses are reserved for each slot. When using 16-channel DI/DO
modules, two byte addresses are lost in every slot!
Rule The following rule is valid for the logic operation of two addresses after XOR:
the output has signal state "1", when one and only one of the two checks is
fulfilled ("one and only one of two" ).
Attention! This rule cannot be generalized to "one and only one of n" ! for the logic
operation of several addresses after XOR !!
As of the third XOR instruction, the old RLO is gated with the new result of
check after XOR.
Result of Check When the program is executed, the result of check is obtained. If the check
condition is fulfilled, the result of check is “1”. If it is not fulfilled, the result of check is
“0”.
First Check The result of the first check is stored as the result of logic operation (RLO).
Result of Logic When the next check instructions are executed, the result of logic operation is
Operation gated with the result of check and a new RLO is obtained.
When the last check instruction in a logic operation has been executed, the RLO
remains the same. A number of instructions using the same RLO can follow.
Note The result of the first check is stored without being subjected to a logic operation. It
therefore makes no difference whether you program the first check with an AND or
an OR instruction in STL. To enable your program to be converted into one of the
other
th programming i llanguages, you should,
h ld hhowever, always
l program using
i ththe
correct instruction.
Set If RLO= "1", the specified address is set to signal state "1" and remains set until it is
reset by another instruction.
Reset If RLO= "1", the specified address is reset to signal state "0" and remains in this
state until it is set again by another instruction.
Priority In LAD and FBD there are different symbols for Dominant Set and Dominant Reset
functions.
In STL, the instruction that was programmed last has priority.
Note If an output is set with a Set instruction, it is reset on a complete restart of the CPU.
If M 0.0 in the example above has been declared retentive, it will remain in the set
state after a complete restart of the CPU and the reset output Q 9.3 will be be
assigned the set state again.
CLR The CLEAR instruction changes the RLO to "0" (only available in STL at present!).
SET The SET instruction changes the RLO to "1" (only available in STL at present!).
SAVE The SAVE instruction saves the RLO as "BR" in a register (status word).
MCRA The MCRA instruction activates the Master Control Relay function.
MCR( “MCR(“ opens an MCR area and triggers an instruction that shifts the RLO to
(for STL) the MCR stack. The stack can have up to eight entries. This means that up to eight
individual control areas can be nested between the “MCRA” and “MCRD”
instructions.
MCRD The "Deactivate Master Control Relay” instruction deactivates the MCR function. No
more MCR areas can be opened until another “MCRA” instruction is given.
Inserting In LAD aund FBD, you use the Program Elements browser to insert a label:
a Label Program Elements -> Logic Control / Jump -> Label.
In STL,
STL you enter the label to the left of the statement,
statement from which program
exeuction is to continue.
JCN The conditional jump “JCN” is only executed if the RLO is "0".
If the RLO is "1", the jump is not executed and program execution continues with
the next instruction.
Note STL provides additional jump operations, which are discussed in another
programming
p g g course.
Positive Edge When the RLO changes from “0” to “1”, the "FP" check instruction results in signal
state "1" (e.g. at M 8.0) for one cycle.
To enable the system to detect the edge change, the RLO must also be saved in an
FP bit memory, or data bit (e.g. M 1.0).
Negative Edge When the RLO changes from “1” to “0”, the "FN" check instruction results in signal
state “1”
1 (e.g.
(e g at M 8
8.1)
1) for one cycle
cycle.
To enable the system to detect the edge change, the RLO must also be saved in an
FN bit memory, or data bit (e.g. M 1.1).
Example Input I 1.0 acts as a static Enable. Input I 1.1 is to be monitored dynamically and
every signal change is to be detected.
Positive Edge When the signal state at I 1.1 changes from “0” to “1”, the "POS" check instruction
results in signal state "1" at output Q for one cycle, provided input
I 1.0 also has signal state "1" (as in the example above).
To enable the system to detect the edge change, the signal state of I 1.1 must also
be saved in an MM_BIT
BIT (bit memory or data bit) (e
(e.g.
g M1 1.0).
0)
Negative Edge When the signal state at I 1.1 changes from “1” to “0” , the "NEG" check instruction
results in signal state "1" at output Q for one cycle, provided input
I 1.0 has signal state "1" (as in the example above).
To enable the system to detect the edge change, the signal state of I 1.1 must also
be saved in an M_BIT (bit memory or data bit) (e.g. M 1.1).
What to Do 1. Draft out the program for controlling the operating modes.
Use the I/O addresses and field devices shown in the diagram.
2. Create an S7 program with the name "FILL" in the project "My Project".
3. Write the mode section of the program for the bottling plant in block FC 15.
4. Open (off-line) the OB1 and enter a call to FC15
(in STL with the statement “CALL FC 15”).
5 Save
5. S your program, ddownload
l d it and
d ttestt it on th
the ttraining
i i unit.
it