08 - S7-200 Getting Started Sample Program
08 - S7-200 Getting Started Sample Program
08 - S7-200 Getting Started Sample Program
Step 2:
Step 3:
Step 4:
Step 5:
Step 6:
Step 7:
Step 8:
Pump 1 Controls
Pump 2 Controls
Pump_2
Q0.1
Pump_1
Q0.0
Start_1
I0.0
Start_2
I0.1
Stop_1
I0.2
Stop_2
I0.3
High_Level
I0.4
Steam_Valve
Low_Level
I0.5
Mixer_Motor Q0.2
Drain_Valve
Q0.4
Figure 4-2
Q0.3
Drain_Pump
Q0.5
4-3
Table 4-1
4-4
STL
Description
NETWORK 1
LD
Start_1
O
Pump_1
A
Stop_1
AN
High_Level
=
Pump_1
NETWORK 2
LD
Start_2
O
Pump_2
A
Stop_2
AN
High_Level
=
Pump_2
NETWORK 3
LD
High_Level
S
Hi_Lev_Reached, 1
NETWORK 4
LD
Hi_Lev_Reached
TON
Mix_Timer, +100
NETWORK 5
LDN
Mix_Timer
A
Hi_Lev_Reached
=
Mixer_Motor
=
Steam_Valve
NETWORK 6
LD
Mix_Timer
AN
Low_Level
=
Drain_Valve
=
Drain_Pump
NETWORK 7
LD
Low_Level
A
Mix_Timer
LD
Reset
CTU
Cycle_Counter, +12
NETWORK 8
LD
Low_Level
A
Mix_Timer
R
Hi_Lev_Reached, 1
NETWORK 9
MEND
Network 1
Start_1
Stop_1
High_Level
Pump_1
Pump_1
Network 2
Start_2
Stop_2
High_Level
Pump_2
Pump_2
Network 3
High_Level
Hi_Lev_Reached
S
1
Network 4
Hi_Lev_Reached
Mix_Timer
TON
IN
+100
Network 5
Mix_Timer
PT
Mixer_Motor
Steam_Valve
Network 6
Mix_Timer
Drain_Valve
Drain_Pump
Network 7
Low_Level
Cycle_Counter
CTU
CU
Reset
R
+12
Network 8
Low_Level
PV
Hi_Lev_Reached
R
1
Network 9
Figure 4-3
4-5
4.2
The CPU Type dialog box is displayed. Select your CPU type from the drop-down list box.
Project
Project Edit View CPU Debug Tools Setup Window Help
New...
Ctrl+N
Open...
Ctrl+O
CPU Type
1 c:\microwin\project1.prj
Select or read the CPU type from your PLC if you would like the software to
2 c:\microwin\project2.prj
limit the available options to only those supported by a specific CPU.
3 c:\microwin\project3.prj
Exit
OK
Figure 4-4
4-6
Cancel
1.
2.
3.
Project
Project Edit View CPU Debug Tools Setup Window Help
New...
Ctrl+N
Open...
Ctrl+O
Close
Save All
Ctrl+S
Save
As Project
Save As...
Save in:
Import
Export
Projects
sample.prj
Upload...
Ctrl+U
Download...
Ctrl+D
Enter project
name here.
Page Setup...
Print Preview...
project1.prj
Print...
File
name:
Ctrl+P
Print Setup...
Exit
Figure 4-5
Save
Cancel
Help
4-7
4.3
Select the first cell in the Symbol Name column, and type the following: Start_1
2.
Press ENTER to move the focus to the first cell in the Address column. Type the address
I0.0 and press ENTER. The focus moves to the cell in the Comment column.
(Comments are optional, but they are a useful way to document the elements in your
program.)
3.
Press ENTER to start the next symbol row, and repeat these steps for each of the
remaining symbol names and addresses.
4.
Address
Comment
Start_1
I0.0
Start_2
I0.1
Stop_1
I0.2
Stop_2
I0.3
High_Level
I0.4
Low_Level
I0.5
Reset
I0.7
Pump_1
Q0.0
Pump_2
Q0.1
Mixer_Motor
Q0.2
Steam_Valve
Q0.3
Drain_Valve
Q0.4
Drain_Pump
Q0.5
Hi_Lev_Reached
M0.1
Memory bit
Mix_Timer
T37
Cycle_Counter
C30
Figure 4-6
4-8
Note
Symbol names are case-sensitive. The name you enter must match exactly the uppercase
and lowercase characters entered in the symbol table. If there is any mismatch, the cursor
stays on the element and the message Invalid parameter appears in the status bar at the
bottom of the main window.
4-9
4.4
Normally Open
F2
F3
F4
F5
F6
F7
F8
F10
Network 1
Family
listing
Instruction
listing
Vertical and
horizontal line
buttons
Normally open
contact button
Normally closed
contact button
Figure 4-7
F2
Normally Open
Network 1
/
I
/I
F3
F4
F5
F6
F7
F8
F10
I0.0
NOT
P
N
Figure 4-8
4-10
Instruction Toolbar
for the Ladder Editor
Double click on or near the numbered network label to access the Title field in the
Comment Editor. Type the comment shown in Figure 4-9, and click OK.
2.
Press the down arrow key. The ladder cursor moves down to the first column position on
the left.
3.
Select the normally open by selecting Contacts from the family listing and then
selecting Normally Open from the instruction listing.
4.
Press ENTER, and a normally open contact appears with the name Start_1 highlighted
above it.
(Every time you enter a contact, the software displays the default address of I0.0, which
in this example is defined as Start_1 in the Symbol Table.)
5.
Start_1 is the first element required for Network 1. Press ENTER to confirm the first
element and its symbol name. The ladder cursor moves to the second column position.
Contacts
F2
Network 1
Normally Open
F3
F4
F5
F6
F7
F8
F10
Start_1
Press ENTER to
place element.
Figure 4-9
Follow these steps to enter the remaining contacts of the first network:
1.
Press ENTER to enter the second element. A normally open contact appears with the
default symbol name Start_1 highlighted above it.
2.
Type Stop_1 and press ENTER. The cursor moves to the next column.
3.
Click the normally closed contact button (F5). A closed contact appears with the default
symbol name Start_1 highlighted above it.
4.
The ladder network should look like the one shown in Figure 4-10.
Contacts
F2
Network 1
Start_1
Figure 4-10
Normally Closed
F3
F4
F5
F6
F7
F8
F10
High_Level
4-11
The ladder cursor is now positioned to the right of the normally closed High_Level input.
Refer to Figure 4-11 and follow these steps to complete the first network:
1.
Click the coil button (F6) and move the mouse cursor inside the ladder cursor and click.
A coil appears with the name Pump_1 highlighted above it. (Each coil that you enter is
given the default address of Q0.0, which in this case has been defined as Pump_1 in the
symbol table.)
2.
3.
Use the mouse or press the left arrow key to move the cursor back to the first element of
the current network.
4.
Click the vertical line button (F7) to draw a vertical line between the first and second
contacts.
5.
Click the normally open contact button (F4) on the toolbar, and press ENTER. A contact
with the name Start_1 appears.
6.
Output Coils
Network 1
Start_1
F2
Output
F3
F4
F5
F6
F7
F8
F10
High_Level
Pump_1
Coil button
Vertical line
button
Pump_1
Type symbol
name here.
Figure 4-11
4-12
Use the mouse or press the down arrow key to move the cursor to Network 2.
2.
In the network comment field, type the comment shown in Figure 4-12. (Since the
comment for Network 2 is nearly identical to the one for Network 1, you can also select
and copy the text from Network 1 and paste it into the comment field for Network 2, then
change the paint ingredient number to 2.)
3.
Repeat the steps you used to enter the elements of Network 1, using the symbol names
shown in Figure 4-12.
4.
Contacts
F2
Network 2
Normally Open
F3
F4
F5
F6
F7
F8
F10
Start_2
Stop_2
High_Level
Pump_2
Pump_2
Figure 4-12
4-13
4.5
Select the first cell in the Address column, and type the following: Start_1
2.
Press ENTER to confirm your entry. This element type can only be displayed in bit format
(either 1 or 0), so you cannot change the format type.
3.
Select the next row, and repeat these steps for each of the remaining elements, as
shown in Figure 4-13.
When an Address cell is in focus and the row below is empty, pressing ENTER
automatically increments the address for each additional row. Refer to the online Help for
more information about using the Status Chart.
You can use the menu command Edit Insert Row (or the INSERT or INS key) to insert a
blank row above the row containing the cursor.
4.
The timer T37 and the counter C30 can each be displayed in other formats. With the
focus in the Format column cell, press the SPACEBAR to cycle through the formats that
are valid for these element types. For this example, select Signed for the timer and
counter.
Status Chart
Address
Start_1
Start_2
Stop_1
Stop_2
High_Level
Low_Level
Reset
Pump_1
Pump_2
Mixer_Motor
Steam_Valve
Drain_Valve
Drain_Pump
Hi_Lev_Reached
Mix_Timer
Cycle_Counter
Figure 4-13
4-14
Format
Bit
Bit
Bit
Bit
Bit
Bit
Bit
Bit
Bit
Bit
Bit
Bit
Bit
Bit
Signed
Signed
Current Value
2#0
2#0
2#0
2#0
2#0
2#0
2#0
2#0
2#0
2#0
2#0
2#0
2#0
2#0
+0
+0
Change Value
4.6
Set the CPU mode switch (which is located under the access cover of the CPU module)
to TERM or STOP.
2.
in the main
window.
3.
4.
5.
The Download dialog box allows you to specify the project components you want to
download. Press ENTER or click OK.
An information message tells you whether or not the download operation was successful.
Note
STEP 7-Micro/WIN does not verify that your program uses memory or I/O addresses that
are valid for the specific CPU. If you attempt to download a program that uses addresses
beyond the range of the CPU or program instructions that are not supported by the CPU,
the CPU rejects the attempt to download the program and displays an error message.
You must ensure that all memory locations, I/O addresses, and instructions used by your
program are valid for the CPU you are using.
1.
2.
4-15
Contacts
F2
Network 1
Start_1
Execute Scans...
Ladder Status On
Normally Open
F3
F4
F5
F6
F7
F8
F10
Fill the tank with Paint Ingredient 1 and monitor the tank.
Stop_1
High_Level
Pump_1
Pump_1
Figure 4-14
If your STEP 7-Micro/WIN program does not match the CPU program, you are notified by the
warning screen shown in Figure 4-15. You are then asked to either compare the program to
the CPU, continue this operation, or cancel the operation.
Contacts
Timestamp Mismatch
F2
Normally Open
F3
F4
F5
F6
F7
F8
F10
The STEP 7-Micro/WIN project timestamps are not the same as the CPU
timestamps. This indicates that the project has been changed.
!
Network 1 ContinuingFill
tank with
1 and
monitor
the tank.
thisthe
operation
mayPaint
result Ingredient
in unpredictable
program
behavior.
Start_1
Created:
From Project
Stop_1
High_Level
10/31/97 - 11:59:36 AM
10/31/97 - 11:59:37 AM
From CPU
Pump_1
12/31/83 - 11:00:00 PM
12/31/83 - 11:00:00 PM
Pump_1Compare
Continue
Figure 4-15
4-16
Cancel
! To view the current PLC value of the elements in your program, click the Single Read
button
window.
Write
Chart Status On
Address
Start_1
Start_2
Stop_1
Stop_2
High_Level
Low_Level
Reset
Pump_1
Pump_2
Mixer_Motor
Steam_Valve
Drain_Valve
Drain_Pump
Hi_Lev_Reached
Mix_Timer
Cycle_Counter
Figure 4-16
Format
Mark Forced
Bit
Unmark Forced
Bit
Force Value
Bit
Bit
Unforce Value
Bit
Read All Forced
Bit
Unforce All
Bit
Bit
Bit
Bit
Bit
Bit
Bit
Bit
Signed
Signed
Current Value
2#1
2#0
2#1
2#0
2#0
2#0
2#0
2#1
2#0
2#0
2#0
2#0
2#0
2#0
+0
+0
Change Value
4-17