Getting Started With The Siemens PLC

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Getting Started with the Siemens PLC

Introduction

This document has been prepared to help the student get started using Siemens PLC’s in
E1-17. The student should read the entire document before starting, and then go through
step-by-step to get comfortable using the PLC and Programming Software.

GETTING STARTED WITH THE SIEMENS PLC 1


Introduction 1

Starting the Software 2

The Main Screen 2


Status Chart 6
Symbol Table 7
Program Block 8

Creating a Program 9
Downloading a Program 11
Running a Program 12
Displaying Program Status 13

Page 1 of 13
Starting the Software

The software for programming Siemens PLC is called STEP 7-MicroWIN. We are
currently using Version 4. To start is follow the path (Figure 1):
Start|Robotics|Simatic|STEP 7-MicroWIN V4.0.0.81|STEP 7-MicroWIN

Figure 1 - Starting the PLC programming software

In a few seconds you will see the splash screen (Figure 2) as the program starts. If you
see a different splash or no splash at all, you have likely started the wrong software.

Figure 2 - Splash Screen

The Main Screen


Once the program has started, you will see a busy main screen.

Page 2 of 13
Across the top are the Menu and Tool Bars (Figure 3). The tool bars have buttons for
many commonly used controls. There are also a lot of buttons that will not be
immediately useful in this course.

Figure 3 - Tool Bars

On the left side of the screen is the “Navigation Bar”. This has
buttons for many commonly used ‘Views’, such as the Program
Block, Symbol table and Status chart.

The Program Block is the area where programs are created.

The Symbol Table is where individual input, output and memory bits
are given Symbols, or names, that can be used to identify the bit
addresses for program instructions.

The Status Chart is used to determine the on or off status of any bit,
or to force a bit to be on (or off) regardless of the current program.
This can be very useful when debugging large programs.

The Data Block can be used to set starting values for variables, if
needed.

The System Block is used to examine and set various system


configuration parameters.

Cross Reference is a useful window that will list all addresses used
and the Networks (Ladder Rungs) they are used on.

Communications and Set PG/PC Interface are used when different


Communication Paths need to be set up.

Figure 4 - Navigation Bar

Clicking on the “Tools” button at the bottom of the Navigation Bar (not visible in Figure
4) will change it to display buttons for Wizards that can help with advanced programming
facilities that are beyond the scope of this course.

Beside the Navigation Bar is a frame containing the “Instruction Tree”.

Page 3 of 13
The Instruction Tree has two parts. The top part is labeled
with the name of the current program (called “Projects” in
this software), Project1 in Figure 5. When you have saved a
file with a new name, that name (and the directory path)
will be shown on the first line.

The next rung shows the model of PLC being programmed.


If this doesn’t say ‘CPU 224 REL 02.01’ double-click on
the line and click on the “Read PLC” button on the PLC
Type Window. (Power to the PLC must be on.)

The next several lines are the same as the buttons described
in the Navigation Frame on the previous page.

The bottom section of the Instruction Tree is where the


programming instructions can be found. In this semester the
instructions we will use the most can be found in ‘Bit
Logic’, ‘Counters’, and ‘Timers’.

Commonly used instructions can be dragged into the


‘Favorites’ folder if they aren’t already there.

Figure 5 - Instruction Tree

At the bottom of the screen is the “Output Window”. This is where the software will
display any messages to you. If something isn’t working the way you expect, check for
error messages in the output window (figure 6). You can make the window larger by
dragging the top edge, and you can use the scroll bar on the right side to move up and
down through the messages.

Figure 6 - Error Displayed in Output Frame

TIP – If you double-click on the described error when the Program Block is open, the edit
cursor will move to the location of the error.

Page 4 of 13
The rest of the screen is the Main Frame. This is where all the action is. The side and top
of the Main Frame can be dragged to make it bigger or smaller.

The Main Frame is always visible, but the other Frames can be toggled on or off from the
View Menu (Figure 7)

Figure 7 - View Menu

If there is a checkmark beside the name of the frame, it will be visible.

While you have this menu open, make sure there is a checkmark beside ‘Ladder’ and
‘Symbolic Addressing’, as shown above.

The Main Frame can display several different windows, selected from the Navigation
Frame or the Instruction Tree.

You can examine inputs and outputs to see if they are On or Off, or Force inputs On or
Off in the Status Chart (Figure 8). We will use the Force capability in the first Lab to
determine how the outputs are connected to the solenoids.

You can create a list of names to represent Input and Output addresses by using the
Symbol Table (Figure 9). It is easier to remember a name like ‘a0’ rather than an address
of I0.0 when entering a program. It is also easier to determine what is going on in a
program when there are descriptive names for the inputs, outputs, and memory bits.

You will enter your program as ladder rungs in the Program Block (Figure 10). Each rung
will be a separate Network in the window. Every rung can have a descriptive comment
associated with it.

Page 5 of 13
Status Chart

Figure 8 - Status Chart

The Status Chart can be used to examine individual addresses in the computer to
determine the current state of the bit: ON or OFF.

It can also be used to Force a bit ON or OFF. A bit that is forced will continue to hold its
status no matter what the program in the PLC decides. This can be a useful tool for
troubleshooting a problem but using it too much can create many more problems than it
solves.

When you first open the Status Chart, all the spaces will be blank. Click in the first space
in the “Address” column and type the address for which you wish to check the status.
Repeatedly pressing ENTER will add consecutive addresses in the following lines.

When all the addresses are entered, press the “Read Status” button . The column
labeled “Current Value” will show the current status of those addresses. It should show
‘2#0’ for each address. The ‘2#’ refers to the PLC communication setup and the ‘0’
means that that bit is OFF.

We can make an output turn on and off by entering a ‘1’ or ‘0’ in the “New Value”

column for the bit you want to change, and then pressing the “Force” button . After
forcing a bit ON, it should be forced OFF before turning on another bit, to be sure that
both solenoids of a double solenoid valve are not energized at the same time.

When you are finished using the Status chart, be sure to clear all the forces by pressing
the “Unforce All” button , so that the outputs can be turned on and off by the
program.

Page 6 of 13
Symbol Table

Figure 9 - Symbol Table

The Symbol Table is used to give a descriptive name (Symbol) to a specific input, output,
or internal address to make writing programs easier. It is usually easier to remember (and
type) a symbol such as ‘a0’ instead of the address ‘I0.0’. It is also easier to understand the
program if each instruction has a symbol instead of the address.

When you first open the Status Chart, all the spaces will be blank. Click in the first space
in the “Symbol” column and type the symbol you wish to use, then type the
corresponding address in the “Address” column. The “Comment” field provides a space
for an optional description for the bit.

When you have created a Symbol table with all the addresses used by the lab boards, (the
table in Fig. 9 is not accurate), save the file to permanent storage (your H: drive or a USB
drive). Anytime you want to create a new program, you can open the file that has the
symbol table, then immediately save it with a new name. That way, you will always have
a completed symbol table available.

Page 7 of 13
Program Block

Figure 10 - Program Window

A good programmer will document a program with comments to explain operation. This
will make it easier for others (and even the programmer) to understand the intended logic
of a program. Something that is obvious now may not be as clear later, for example when
you are studying for a test.

The box with the text “PROGRAM COMMENTS” is intended for general comments
about the entire program. This would be a good place to put the names of the
programmers and any general description of the program.

Each Network (which is what Siemens calls a rung) can have a one line “Title” and a
multiline comment.

Page 8 of 13
Creating a Program
The first step in creating a program is to open the software and start a new file. Open
your saved file with the Symbol Table, if you have one. If you haven’t created and saved
a symbol table, you are making your job harder than it needs to be.

This simple program will cause cylinder A to extend and retract when the pushbutton is
pressed.

Put in program comments identifying the programmers and a program title. Also enter a
title and comments for Network 1.

Open the Bit Logic group under Instructions in the Instruction Tree

Drag the NO contact to the beginning of Network 1,


on top of the arrowhead. Identify it as the symbol you used for
pushbutton 1.

Drag another NO contact to the right of the one-shot (on top of


the arrowhead) and identify with the symbol for the cylinder A
retracted limit switch.

Drag the Output coil to the right (on top of the


arrowhead). Identify it with the symbol for the output that
energizes the solenoid that extends cylinder A.

The first rung is now complete. Notice that there is no longer an


arrowhead at the end of the rung. Nothing can be added to the
right of an Output instruction.

Enter title and comment for the second Network (rung).

Drag a NO contact for limit switch a1 and an Output coil for the A retract solenoid.

If you need internal memory bits in your program (e.g., Home or Step 1), use addresses
M0.0 to M0.7, for more bits use M1.0 and continue with the same pattern.

Save the program as “Name”. It should look like Figure 11 on the next page. This
program is just an example, it might not work on your station.

Page 9 of 13
Figure 11 - Sample Program

How to use help


Pressing F1 will open a help window for the instruction that is currently selected. If you
see the message below, click Yes.

Then, navigate to folder C: > Program Files (x86) > Siemens > STEP 7-MicroWIN V4.0
> Help as shown below, and click Open. See the figure below:

Page 10 of 13
Downloading a Program

Note: PLC power must be turned on before downloading.

Before downloading, the program will be compiled into a format the PLC can
understand. This will happen automatically during the download process but doing it
manually first is a quick way to check for syntax errors. Press the Compile button
and the results of the compile will be displayed in the Output Frame. For example, for my
sample program the last line in the Output Frame is:

Block Size = 27 (bytes), 0 errors

If there are errors, they must be corrected before the program can be downloaded. The
Compile process can only catch syntax errors, not logic errors, so an incorrect program
may compile correctly, but not function the way you expect.

When there are no errors in a program, it can be downloaded. Press the Download button

to start the process. The program will be compiled and then the Download window
will open (Figure 12 on next page). Press Download to complete the process.

Output Frame will show “Download was successful” when the program has been
transferred to the PLC.

Page 11 of 13
Figure 12- Download Window

Running a Program

Once the program has successfully been downloaded to the PLC, the PLC must be told to

start executing the program. Press the RUN button to start the program. A
confirmation window will open:

Press Yes to start the PLC. The program will start running.

Press pushbutton 1 to cause the cylinder to extend and retract. (Make sure the air is
turned on!)

Page 12 of 13
Displaying Program Status

To help to understand what might be happening in the PLC while a program is running,
especially if the program is not producing the required results, the software can display
the status of each bit on the ladder diagram.

To turn on the status, open the Debug menu and select Start Program Status.

The Program Frame will change to show the status of all bits:

Program Status must be stopped before any changes can be made to a program.

Page 13 of 13

You might also like