Modifying The Sample Program; Creating The Blink Patterns For The Led - Siemens Simatic S7-200 CPU 210 System Manual

Table of Contents

Advertisement

3.9

Modifying the Sample Program

You can use the following networks of control logic to modify the sample program. These
networks provide the following enhancements to the sample program:
If Zone 1 is open, the LED flashes one time.
If Zone 2 is open, the LED flashes two times.
If both zones are open, the LED flashes three times (one short flash, followed by a pause
and then two short flashes).
The modified program uses the memory addresses shown in Table 3-3. If you used symbolic
addressing with your program, add these symbolic names and addresses to the Symbol
Table.
Table 3-3
Element
Address
Internal
Internal
Memory
Memory
Timers

Creating the Blink Patterns for the LED

The program uses different bit patterns as the basis for the logic that turns the LED on and
off. Based on the condition, the program loads a value into the word that stores the blink
pattern. Figure 3-24 shows the networks that move the bit patterns into MW3. Use
STEP 7-Micro/WIN to enter the networks into the program.
Network 6
If Zone 1 is open and Zone 2 is closed, then load the
value 231 (1110011100) in MW3
I0.0
/
Network 7
If Zone 1 is closed and Zone 2 is open, then load the
value 165 (1010010100) in MW3
I0.0
Network 8
If both Zone 1 and Zone 2 are open, then load the value
167 (1110010100) in MW3
I0.0
/
Figure 3-24 Control Logic for Lamp Operations
S7-200 Programmable Controller, CPU 210
C79000-G7076-C235-01
Memory Locations Used to Modify the Sample Program
Symbolic Name
M0.7
Blink_Bit
MW1
Step_Counter
MW3
Blink_Pattern
T1
Blink_Timer
LAD
I0.1
MOV_W
EN
+231
IN
OUT
MW3
I0.1
MOV_W
/
EN
+165
IN
OUT
MW3
I0.1
MOV_W
/
EN
+167
IN
OUT
MW3
Getting Started with a Sample Program
Description
Stores the status for the LED
Tracks the blinking of the LED
Stores the pattern for flashing the LED on and off
Increments the step counter
NETWORK
LDN
A
MOVW
NETWORK
LD
AN
MOVW
NETWORK
LDN
AN
MOVW
STL
I0.0
I0.1
+231, MW3
I0.0
I0.1
+165, MW3
I0.0
I0.1
+167, MW3
3-25

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents