Documente Academic
Documente Profesional
Documente Cultură
com/book/export/html/373
This is a listing of tutorials and manuals found on the Siemens automation website that will get you
started on the SIMATIC Step 7 software for S7-300 and S7-400 systems. From a new users perspective
Ive only heard disparaging comments about finding the right information on the Siemens website. I
have to agree. Its information overload at its best. Theres a lot of different stuff there thrown together
and found in different spots with very long URL addresses to add to the confusion.
Have no fear. Were here to help. So well look at the essentials for your journey.
Of course the best type of training is the hands on type but if thats not an option then youll need to
start digging in.
1 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
If you are just learning and cant easily get the software then there are two options.
1. Order the demo CD which will give you a free 30-day trial period.
2. Download a free working copy of Step 7 Lite. There are differences between the regular version
of Step 7 and Step 7 Lite but for learning purposes you can go along way with the free Lite
version.
The first thing I like to do with a new product is get an overview of everything. Getting used to part
numbers and product groupings can go a long way with your comfort level. The best thing for this is the
sales catalog (ST 70 2005). You can also order a hard copy.
Once you install the Step 7 software there will be a directory under the SIMATIC folder called
Documentation that includes the most important manuals. Hard copies can be ordered with number
6ES7810-4CA08-8BW1. Heres how I would digest them.
1. Working with STEP 7 - This is a basic introduction to Step 7 which walks through an example
of controlling engines. While its not the complete picture it does ease you very well into the
learning curve of the Step 7 software.
2. Programming with STEP 7 Manual - Heres the fuller manual for the programming interface
which is also the same as the online help accessed by pressed the F1 key.
3. Configuring Hardware and Communication Connections STEP 7 Manual - Everything to do
with the Hardware Configurator.
4. Statement List, Ladder Logic, and Function Block Diagram Reference Manuals - These
manuals contain both the users guide and the reference description of the programming language
or representation type. You only require one language type for programming an S7-300/S7-400,
but you can mix the languages within a project, if required. If youre more comfortable with
Ladder Logic or Function Block Diagram then start there but sooner or later youll have to
become familiar with Statement List.
5. System Software for S7-300 and S7-400 System and Standard Functions Reference Manual -
The S7 CPUs have integrated system functions and organization blocks included with their
operating system, which you can use when programming. This manual provides you with an
overview of the system functions, organization blocks, and loadable standard functions available
in S7, and detailed interface descriptions for their use in your programs.
Training Material
Theres gold in that website if you just do a little digging! If youre having a tough go with the manuals
then you should definitely download the training material. Theres a lot more screen shots and even a
picture of a balding pudgy guy to point things out to you. What more could you want?
Flash Tutorials
If youre not the manual type (and even if you are) check out the Siemens Step 7 Flash tutorials. These
are very professionally done with a nice sounding narrator to take you through all the basics of the Step
7 software and hardware.
What's Next?
Of all the starting places to dig for more info I find the support section the best especially if you have a
part number or key word you can search on. Clicking on the Product Support link will bring up a tree on
2 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
the left hand side that can be expanded down to the product of your affection. Good luck and happy
hunting.
When one hears the words Lite and software you tend to think of software thats not really
usable. Depending on your needs this may not be the case with the Siemens STEP 7 Lite package. The
four major limitations in STEP 7 Lite verses the more advanced STEP 7 package are:
3 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
1. Support limited to the SIMATIC S7-300 PLC, the C7 all-in-one PLC and
HMI, and the intelligent CPUs of the ET200 distributed I/O family. So no
programming for the S7-200 or S7-400 PLC series.
2. No networking whatsoever. Remote I/O racks (IM modules) are
supported but theres nothing for Profibus DP even if you have a DP
port on your CPU.
3. No support for multi-projects or HMI integration.
4. No communication processors (CP) or function modules (FM) supported.
If youre interested in more details then refer to our chart of differences between
the Step 7 program packages. So there are quite a few major limitations with the Step 7
Lite software which may end your further reading of this review.
On the other hand, the current availability of a free download of the SIMATIC Step 7 Lite software
makes it awfully tempting to take a look at it. If your only use of Siemens PLCs are an S7-300, C7 or
ET200 in a stand alone application with no special needs (CP or FM) then I could highly recommend
the Lite package. It has the same level of programming functionality as the regular Step 7 packages plus
some nifty interface enhancements to make it easier on the eyes and on the brain. It is possible (though
not easy) to convert any software created in the STEP 7 Lite to STEP 7 and visa versa keeping in mind
the limitations of the Lite version. Since the packages bear a lot of similarities it will also be easy for the
student to transfer any learning on the Lite package over to STEP 7.
First Impressions
For a user of the regular STEP 7 software the first thing to notice is there is no SIMATIC Manager.
Thats because the Lite version doesnt support multi-projects or networking. The STEP 7 Lite
software opens right up to the editor screen.
The overall aim of the Lite package was to make the interface easier for new users. I think theyve
done that while making it friendlier for everyone involved. The added graphics and color are a welcome
addition. Another nice friendly feature is the extended hover help on the menus and icons where
clicking on the tool tip expands it into more help text. On that note all the pop up dialogs are clearer
4 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
One of the major differences can be seen on the left hand side window. Pretty much everything the
programmer needs for maintaining the project is neatly organized here. Theres even a convenient
thumb tack to pin it or make it automatically slide in and out when needed.
On the right hand side is the old familiar tree structure of commands and blocks. Its missing the
quick little reference help window on the bottom which has been replaced by just hovering your mouse
over the command to get a fuller title (the F1 key works just the same too). The FC and FB blocks have
been moved from here to a more logical place in the project window on the left hand side.
The top portion introduces a CPU box with easy access to controls,
diagnostics (Ctrl+D) and setup of the CPU. Thats not something I feel is
necessary to be there all the time so I minimized it. Too bad theres no
apparent way to just get rid of it all together.
Its also nice to have all the blocks clearly color coded and nicely
arranged. You can drag and drop then anywhere in the list. Theres even
a new feature of Category which is simply an organizational label
inserted between blocks. In this screen Ive inserted the category
Engine Data and Special Data. This could be really helpful for
logically grouping blocks in larger projects.
I also like the new way of creating blocks. From the pull down menu select
Insert | Block and this nifty dialog box pops up with all the selections on
it. Even the OB selection has a nice drop down box of all the OBs available
with its symbolic name.
The greatest change of all is the overhauled hardware manager. The layout is great and is to be
expected without the need to factor in networking. Just drag and drop your hardware on the picture and
away you go. Theres even a nice hardware comparison feature clearly showing any differences
between the offline and online setups.
5 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
The Editor
Much of the editor is like its big sister STEP 7. One noticeable part thats missing in action is
the detail view that gives quick access to info, cross reference, address info, etc. One part I like is a
slight revamp of the declaration table. Instead of the tree like structure its one simple table with a
column indicating its declaration. That means no having to dig through the tree just to see all the
declaration variables.
6 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
Conclusion
Other then what weve all ready listed there are no other major differences. The symbol table,
monitor/modify (a.k.a. VAT), and the reference data are all very similar to STEP 7. Overall, if you can
live with the limitations, the STEP 7 Lite version is a great little package. Hopefully some of the better
implementations will find there way into the STEP 7 software.
P.S. One little caveat is that it kept crashing on my plenty beefy enough Windows XP Home computer.
Save often, arrgh!
These are general guidelines for connecting, downloading and uploading from an S7-300 or S7-400
PLC. The following procedures were created using Siemens SIMATIC STEP 7 version 5.4 software.
7 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
3. An Ethernet cable
The CP5512 card and the PC Adapter can communicate on either an MPI or PROFIBUS port. Note
8 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
that PROFIBUS is labeled as DP on the Siemens connection ports. These cables can piggyback on
existing connectors. Be aware that the PC Adapter draws its power to work from the connection port so
check the power LED for proper operation. The CP5512 card draws its power from the computer.
For Ethernet (TCP/IP) use a standard Ethernet cable from the computer to a CPU with an Ethernet
port, a CP 343/443 module or a network switch all ready attached to the PLC network.
Checking Communications
With the programming cable plugged in, you can check for proper operation by clicking on the
Accessible Nodes icon.
If communications are successful, you'll see a window pop up similar to the one below. If so, then close
the Accessible Nodes window and proceed to the download or upload section.
This indicates that the cable is not in the right computer port or the cable is not plugged in properly.
In order to start communication to the PLC you will need to match the "PG Interface" setting with the
programming cable and protocol. To do this, select the menu Options > Set PG/PC Interface.
9 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
The following dialog box will open up displaying all the different interfaces (i.e. communication
drivers).
Each cable has its own interface. For Ethernet select the TCP/IP interface for your computers network
card. Be careful not to select your wireless Ethernet connection.
To get it working quickly it is best to select the interface with the Auto designation. This will discover
working settings and use them automatically.
10 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
For the PC Adapter click on the Properties button and make sure the Station Parameters Address is a
unique network address. It should not conflict with existing PLC and slave devices on the network.
Also, check under the Local Connection tab and make sure connection selection matches the port the
cable is connected into.
Once the proper interface is selected and the properties are set then click OK and use the Accessible
Nodes window to check for successful communications. It should work. If not double-check the
connection and cable. With the CP5512 and PC Adapter cables, you should use the MPI port, as this is
the default connection for Siemens.
First, in order to enable the download menu commands, you must select the Block folder in the project's
station you wish to download.
Partial Download
Partial downloads are used in existing projects where only one or more blocks will be downloaded. To
perform this type of download select the block(s) you wish to download and then select the PLC >
Download menu item or the download button .
11 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
Holding down the Ctrl key or the Shift key allows more then one block to be selected at a time. Be
careful though as the order of download will occur in the order that the blocks were selected. This may
mean that an error will occur if a block is called before it is downloaded.
The CPU will need to be in Stop mode before downloading the System Data Block (SDB) as this is
equivalent to a hardware configuration download. This is usually not necessary in a PLC that has all
ready had its hardware configured. If you do download the system data, the following messages will
prompt you through the transitions.
If the CPU is in Run mode then you will be prompted to Stop the CPU. The software will do the Run to
Stop transition when you click OK.
After downloading the SDB you will be prompted to Run the CPU again.
Clicking Yes will automatically put the CPU back into run mode.
12 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
Full Download
To download all the blocks at once make sure you are in the Block folder and select the Edit > Select
All menu item. Click on the Download icon . You will be prompted to overwrite any existing blocks
and if you want to load the system data (see above).
The partial and full download methods above will overwrite existing blocks but will not any blocks from
memory. In order to completely delete the existing program in the CPU and download a new project
select the Blocks folder and then use the PLC > Download User Program to Memory Card menu item.
The following dialog box will pop up prompting you about the deletion of all the blocks and project data
in the PLC. Click Yes to perform the operation.
There are two methods for uploading. The first is when you have the original project and you want to
preserve the symbols and comments. The second method, when you don't have the original project, will
upload everything from the CPU but will have no associated documentation (i.e. symbols and
comments).
With the existing project open, select the View > Online menu item.
13 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
This will open up another window called the Online Partner. It shows the existing blocks inside the
CPU. The Online version is indicated by the highlighted title bar.
14 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
There is a connection between these two versions so that uploading from the online partner makes sure
to preserve all the symbols and comments. Be careful. After uploading, make sure to close the online
partner and do all work from the offline version.
To upload individual blocks, select them in the Online view and choose the PLC > Upload to PG menu
item. For a full upload, select the Block folder and do the same.
Follow these steps when you do not have the original project but wish to upload the program for backup
purposes. With an existing project open or a new blank project select the PLC > Upload Station to
PG menu selection.
15 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
In the next screen, fill in the slot the CPU is in (this is always 2 for S7-300) and the node address of the
communication port on the CPU. In the case below we are talking to a CPU over MPI with node
address 10.
After clicking OK, the whole contents of the PLC including all blocks and hardware configuration will
be uploaded into a new station in the project.
16 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
While this project contains no documentation, it can be used as a backup to download later if needed.
Configuring
Digital, analog
Digital, analog I/O, IFM, FM, CP
Modules I/O, IFM
centralized and distributed (DP)
centralized only
Alarm configuring
No Yes
(display->HMI)
Program,
Export/import Program, symbols, hardware configuration
symbols
17 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
Multi-language documentation of
Yes Yes
projects
Programming
As Step 7
+ S7-Graph
LAD/FBD/STL
Languages LAD/FBD/STL (sequencer)/S7-SCL
and STL sources
(textual high-level
language)
Structured/symbolic
Yes/Yes Yes/Yes
programming
Check/establish program
Yes/Yes Yes/Yes
consistency
Online functions
Monitor, control,
Test functions Monitor, control, force, single step (debug)
force
Program,
Comparison function
hardware Program
offline/online
configuration
Optional packages
S7-Graph,
Optional programming languages None S7-HiGraph, CFC
S7-SCL,
18 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
S7-HiGraph, CFC
S7-PLCSIM, S7-Teleservice,
Options for simulation,
S7-PLCSIM, S7-Teleservice, S7-DOCPRO, S7-Pdiag
documentation, diagnostics and
S7-Teleservice S7-DOCPRO, (S7-PLCSIM is all ready
remote maintenance
S7-Pdiag included in package)
Sound familiar? Have you suddenly found changes that have been made in the PLC but not in the
offline program? Nobody knows what happened.
Unfortunately this is an all too common phenomena with the Siemens SIMATIC Step 7 software. The
problems stem from the flexibility of the software both for downloading and editing the online
program. If the person is not familiar with the software its very easy to get confused if the changes are
being made on the computer or in the controller.
How to solve this problem? Lets first of all review some basic terminology. After that is a step by step
best practice when editing programs. Finally, well highlight the pitfalls and the indicators that tell you
whether you are offline or online. This procedure applies to SIMATIC Step 7 version 5.4.
Terminology
Offline program The program that is stored on the hard disk of the computer. This will contain the
documentation. Its very important to keep a pristine copy of the offline program as the associated
documentation is not stored in the PLC.
Download The act of taking the offline program on the computer and downloading it into the PLC.
Upload Taking the program in the PLC and bringing it up to the computer. Doing this without having
the associated offline program open will cause a loss of documentation.
19 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
Save Stores the open block onto the hard drive. Its important to realize that an edited block can be
downloaded to the PLC without saving it offline. Note that this only saves the opened block and not
any others that are concurrently open.
These may seem like simple terms but its important to understand how theyre used in the Siemens
environment.
PG/PC This is Siemens way of referring to a PC or laptop running the SIMATIC software.
Nodes Refers to any programmable device (in our case a PLC) in the network which will have its
own unique address.
Best Practice
The best practice is to make sure you are working from an offline file. There really isnt any reason to
be working on the program inside the PLC. Of course, this assumes that you have a good working copy
to begin with. The golden copy of the program should live somewhere on a network server or have a
dedicated place on one computer or laptop. Ive even heard of some companies using USB memory
sticks to store the latest and greatest which is great but an original copy should still live on a computer
that is backed up.
1. Open the offline file from the File pull down menu and select Open or use the Open Project
icon on the toolbar. In the dialog box select the project under the User Project tab.
Click OK. You may have to select Browse to find it in the directory structure. Note if the
Manager was closed with a project open then it will open back up to that project automatically.
2. Expand the project tree down to the program files and select the Blocks folder. Good
practice dictates that all blocks should be opened from here.
3. Once changes have been made:
1. Save the block to the hard disk by clicking the Save icon (or menu item File | Save)
2. Download the block by clicking the Download icon (or menu item PLC |
Download). If the block all ready exists in the PLC then it will confirm that you want to
20 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
Thats it. Following these simple steps will save a lot of headaches.
So where do some people get lost? Here are some common mistakes and their warning signs. If you get
any of these dialog boxes then you should really back out and start over because youre on the road to
losing your documentation.
21 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
These dialog boxes are telling you that it cannot find the documentation for the local parameters and
symbols. More then likely it will also not show any network comments or titles.
This is an example void of documentation. Notice the local parameters all say TEMP. There are no
comments or titles. There are no symbols so its all in direct addressing. The properly documented
copy looks like this...
22 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
The Display Accessible Nodes selection under the PLC menu is a handy way to see what is
connected to the network but it should never be used to open blocks. Opening blocks from here
uploads it straight from the PLC and produces the warnings dialog boxes shown above.
23 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
Once a project is open and a connection to a PLC is established then selecting the Online button
(menu View | Online) brings up a similar project tree showing the contents inside the PLC. The window
title bar is highlighted in blue to indicate its online status. Working from this window presents less of a
danger for losing documentation but it is confusing and could lead to problems. For instance if a block
is renamed offline and then the old one is opened online then it will have no associated documentation.
The proper way to view a block online is to open the block and select the Establish Connection to
Configured CPU icon . Just make sure what you are viewing has been downloaded to the PLC.
24 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
If an offline block is open then selecting the Open Offline/Online Partner icon (menu item File |
Open Online) will switch it to the online version of the block for editing. Essentially this puts you in the
same place as pitfall #2.
Conclusion
Programming with SIMATIC Step 7 is different enough from other types of PLCs to throw off the
casual user. Always working from the offline copy will make it less likely to screw up. Opening up a
block from the accessible nodes window is always a no-no. Likewise, opening a block from a window
that has a highlighted blue title bar will also cause potential problems. Be sure and read all dialog boxes
especially the ones weve shown in the article. Avoid the pitfalls and keep that documentation.
Mystery solved.
Footnote:
(1) Siemens dialog boxes have an option that says, Do not display this message again. This is handy
for some annoying pop ups but it is really not a good idea to turn off important ones like warnings for
overwriting blocks. These warnings are especially crucial if you are working on real machinery. If
25 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
more then one person is using the software then you can reset these messages to display again by going
to the SIMATIC Manager and select the menu Options | Customize. Click the General tab and press the
Activate button. If its grayed out then all messages are set to display.
I couldn't find a complete listing of all the function blocks in the standard Siemens S7 Libraries so I
made one myself. It helps me get a better overview of what is available. The complete listing is also
available as an Excel spreadsheet so you can sort or adjust to your needs.
26 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
27 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
28 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
29 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
SFC 65 X_SEND COM_FUNC Send Data to a Communication Partner outside the Local S7
Station
SFC 66 X_RCV COM_FUNC Receive Data from a Communication Partner outside the
Local S7 Station
SFC 67 X_GET COM_FUNC Read Data from a Communication Partner outside the Local
S7 Station
SFC 68 X_PUT COM_FUNC Write Data to a Communication Partner outside the Local
S7 Station
SFC 69 X_ABORT COM_FUNC Abort an Existing Connection to a Communication Partner
outside the Local S7 Station
SFC 70 GEO_LOG IO_FUNCT Determine Start Address of a Module
SFC 71 LOG_GEO IO_FUNCT Determine the Slot Belonging to a Logical Address
SFC 72 I_GET COM_FUNC Read Data from a Communication Partner within the Local
S7 Station
SFC 73 I_PUT COM_FUNC Write Data to a Communication Partner within the Local S7
Station
SFC 74 I_ABORT COM_FUNC Abort an Existing Connection to a Communication Partner
within the Local S7 Station
SFC 78 OB_RT DIAGNSTC Determine OB program runtime
SFC 79 SET BIT_LOGC Set a Range of Outputs
SFC 80 RSET BIT_LOGC Reset a Range of Outputs
SFC 81 UBLKMOV MOVE Uninterruptible Block Move
SFC 82 CREA_DBL DB_CTRL Create a Data Block in the Load Memory
SFC 83 READ_DBL DB_CTRL Read from a Data Block in Load Memory
SFC 84 WRIT_DBL DB_CTRL Write from a Data Block in Load Memory
SFC 85 CREA_DB DB_FUNCT Create a Data Block
SFC 87 C_DIAG COM_FUNC Diagnosis of the Actual Connection Status
SFC 90 H_CTRL HF_FUNCT Control Operation in H Systems
SFC 100 SET_CLKS CLK_FUNC Setting the Time-of-Day and the TOD Status
SFC 101 RTM CLK_FUNC Handling runtime meters
SFC 102 RD_DPARA IO_FUNCT Redefined Parameters
SFC 103 DP_TOPOL DP Identifying the bus topology in a DP master system
SFC 104 CIR PGM_CNTL Controlling CiR
SFC 105 READ_SI PMC_FUNC Reading Dynamic System Resources
SFC 106 DEL_SI PMC_FUNC Deleting Dynamic System Resources
SFC 107 ALARM_DQ PMC_FUNC Generating Always Acknowledgeable and Block-Related
Messages
30 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
31 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
32 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
33 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
Communication Blocks
34 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
35 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
36 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
Miscellaneous Blocks
37 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
FC 63 S_LTINT TIMEFUNC sets the required time interrupt to the preset time. This time is
given in local time.
Otherwise known as Siemens speak. Here's a list of Siemens specific abbreviations and their meanings.
38 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
Type and Size Format Range and Number Notation Example in STL
Description in Options (lowest to highest values)
Bits
BOOL (Bit) 1 Boolean text TRUE/FALSE TRUE
BYTE (Byte) 8 Hexadecimal B#16#0 to B#16#FF L B#16#10
number L byte#16#10
WORD 16 Binary 2#0 to L 2#0001_0000_0000_0000
(Word) number 2#1111_1111_1111_1111
Hexadecimal W#16#0 to W#16#FFFF L W#16#1000
number L word#16#1000
BCD C#0 to C#999 L C#998
Decimal B#(0,0) to B#(255,255) L B#(10,20)
number L byte#(10,20)
unsigned
DWORD 32 Binary 2#0 to
(Double word) number 2#1111_1111_1111_1111_ L 2#1000_0001_0001_1000_
1111_1111_1111_1111 1011_1011_0111_1111
39 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
S5TIME NOTES
S5TIME Format
40 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
41 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
Logic Blocks
FB FB Function block FB 0 to 65535
OB OB Organization block OB 1 to 65535
FC FC Function FC 0 to 65535
SFB SFB System function block SFB 0 to 65535
SFC SFC System function SFC 0 to 65535
Data Blocks
DB DB Data block DB, FB, SFB, UDT 1 to 65535
User-defined data types
UDT UDT User-defined data type UDT 0 to 65535
by Automation Training
The following is provided by Automation Training from their excellent Siemens Step 7 training manual.
This is a really nice explanation of a difficult but important subject. Check out their website for
hands-on and online training classes.
Introduction
The most common form of addressing used in the Siemens S7 PLCs is direct and symbolic. When a
direct addressed is referenced by an instruction there is no question as to the location in memory. The
following are examples of direct addressing:
Timers: T34
Counters: C23
42 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
By using the methods of indirect addressing the address used by an instruction can be varied to point to
any number of locations. In this case, a memory location stores a pointer to another memory
location. While this may increase the difficulty of troubleshooting, its advantage is to greatly reduce the
number of networks and instructions needed to control a process. It is also a method that must be
understood to use some of the library and system function calls provided by Siemens.
A POINTER data type is used to format a number to be accepted as an address rather then a value. A
pointer is always preceded by a P# symbol. The pointer address may be in three different formats.
The ANY data type is used to pass a parameter of an unknown or undefined data type. Some functions
in the library use the ANY data type to work on whole sections of memory. To do this, the last pointer
method is used to describe an area. For example the address P#DB25.DBX 0.0 Byte 14 points to the
first byte of DB25 with a length of 14 bytes.
NOTE: A DINT can be converted to a POINTER by simply shifting the double word left by 3 bits.
When working with indirect addressing it is sometimes needed to first of all open a DB and then begin
working on the
address without directly referring to any one DB. This is done using the OPN instruction. The OPN
instruction can open either a shared data block (DB) or an instance data block (DI).
43 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
When monitoring in STL the shared DB number is displayed in the DB1 column and the instance DB
number is displayed in the DB2 column.
Furthermore, there are instructions to confirm that the correct DB number is opened and that it is large
enough for the next operation.
The first method of indirect addressing is called memory indirect addressing because it allows for a
memory location (M, DB or L) to determine or point to another.
The memory area identifiers T, C, DB, DI, FB and FC use a word (16-bit) pointer location in integer
format. Two examples are as follows:
The memory area identifiers I, Q, M, L, DB use a double word (32-bit) location using the POINTER
data type.
44 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
When monitoring memory indirect addressing the INDIRECT column displays the current address the
instruction is using.
Note that math can be done on the POINTER data type using the double math instructions (e.g. P#2.0 +
P#5.0 = P#7.0).
Since the bit position only goes to eight the result of P#8.7 + P#1.1 = P#10.0 and not P#9.8. These
methods can be used to offset the address or increase/decrease the pointer in a loop.
Besides the regular accumulators, there are two 32-bit address registers (AR1, AR2) for storing pointers
used in register indirect addressing methods. A series of different load and transfer type instructions can
be used to work with AR1. A similar set is available for AR2.
STL Description
45 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
Addition can be directly accomplished on AR1 and AR2 with the following:
STL Description
+AR1 Adds the contents of ACCU1 to AR1 and stores the result back into AR1
+AR1 P#100.0 Adds the pointer constant to AR1 and stores the result back into AR1
The area-internal register indirect addressing method uses one of the address registers plus a pointer to
determine the address the instruction is to reference. The format is:
The address identifier can be I, Q, M, L, DI or DB in bit, byte, word or double word form. The address
register must be previously loaded with a double word pointer without reference to the address
identifier. The exact address is determined by adding the address register with the pointer. The example
below shows the area-internal method using bit locations.
Area-crossing register indirect addressing is similar to the area-internal method except the pointer
loaded into the address register references a memory area (e.g. P#M10.0 or P#DBX0.0). This means
the address identifier used before the opening bracket is not needed if referencing a bit otherwise it will
be a B for byte, W for word or D for double. The example below shows the area-crossing method using
bit locations.
46 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
This next example shows area-crossing methods using a word and double word format.
Exercise #1
1. Comment the lines of STL below to describe what this network does:
A I 0.0
JC M001
L P#M10.0
JU M002
M001: L P#Q0.0
M002: LAR1
A I 0.1
= [AR1, P#0.1]
Exercise #2 (Advanced)
1. Create a DB with an array of 10 real numbers. Populate the array with random values.
2. Create a function that will return the max number in the array and its position. Use the indirect
addressing method of your choice.
In Siemens PLCs the Status Word is an internal CPU register used to keep track of the state of the
47 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
instructions as they are being processed. In order to use STL more effectively it is important to
understand the Status Word and its functions.
Each bit in the Status Word has a specific function to keep track of bit logic (RLO, STA), math (OV,
OS), comparison operations (CC0, CC1) and whether the logic should continue, be nested or start new
(/FC, OR, BR). Only the first 9 of the 16 bits are used.
Bit Positions
8 7 6 5 4 3 2 1 0
Each instruction may do the following to each bit in the status word.
- No read or write
* Read
0 Reset to "0"
1 Set to "1"
The status word can be seen by displaying the STATUS column while monitoring in STL view. The
RLO (bit 1) and the STA (bit 2) are also displayed in the RLO and STA column.
If the /FC bit is a 0 then the instruction is considered to be the first instruction being processed. If the
/FC is a 1 then the instruction being scanned will use the logic from the previous instruction. Certain
instructions like =, S and R will set the /FC bit to 0 thus starting new logic after it. Other instructions
like A or O will set the /FC bit to 1 signalling to combine the logic with the next instruction.
48 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
The RLO bit stores the running logic state of the currently processing instructions. Certain bit logic
and comparison instruction will turn the RLO to a 1 when the condition is TRUE and write a 0 when
the condition is FALSE. Other instructions read the RLO (=, S, R) to determine how they are to
execute.
The STA bit reflects the state of the current Boolean address.
If you are used to ladder logic and struggling to understand the purpose of the RLO and STA it may
help to visualize a rung like below. The STA is used to keep track of the state of the addresses. The
RLO is used to keep track of the state of the rung.
1. At the start the First Check bit (/FC) is zero so an And instruction will logically mirror the Status
bit (STA) over to the Result of Logic Operation (RLO). In this case the address I0.0 is 1 so the
STA is one and the result of the logic (RLO) will be 1. The A instruction writes a 1 to /FC.
2. On the second line, the /FC bit is now 1 indicating that this line needs to use the RLO from the
previous line. The address I1.1 is on so the STA = 1. The RLO from the last line is 1 and this
is anded with the current STA with a result of 1 in the current RLO.
3. The same thing happens on the second line but this time 1 and 0 makes the current RLO = 0.
49 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
4. The fourth is the Assign instruction which takes the RLO and writes it out to the corresponding
address. In this case the final RLO = 0 so the output will be off. If M0.0 was 1 then the
And operation will evaluate to true making the RLO = 1 which will then turn on the output
Q1.0.
OR (bit 3)
In the event of an overflow (OV bit 5) the OS bit will store the value even after the OV bit has been
reset. The following commands reset the OS bit: JOS (Jump if OS=1), block call instructions, block
end instructions.
OV Overflow (bit 5)
The OV bit is set by a math instruction with floating point numbers after a fault has occurred (overflow,
illegal operation, comparison unordered). The OV bit is reset when the fault is eliminated.
The Condition Code bits provide results for comparison and math instructions.
Comparison Instructions
CC 1 CC 0 Meaning
0 0 ACCU 2 = ACCU 1
50 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
CC 1 CC 0 Meaning
0 0 Result = 0
0 1 Result < 0
1 0 Result > 0
CC 1 CC 0 Meaning
CC 1 CC 0 Meaning
0 0 Gradual underflow
CC 1 CC 0 Meaning
51 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
CC 1 CC 0 Meaning
0 0 Result = 0
1 0 Result <> 0
If you are a Siemens PLC user then you've more then likely have run into Statement List (STL)
programming. STL corresponds to the Instruction List language defined in the IEC 61131-3
specification. The programming is done with very simple mnemonics that can be hard to remember if
you don't use it very often.
These cheat sheets provide a quick reference guide for all the instructions and formatting. They are two
pages long but if you can print on the front and back then they make for a nice one sheet reference.
52 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
The TCP/IP method of communication to the S7-300 and S7-400 PLC's via TCP/IP communication
module uses the S7WIN, S7WINSP, S7NT, or S7NTSP protocol.
Software requirements
Hardware requirements
The hardware modules occupy the following slots in the Siemens PLC:
Example configuration
You must log in as an Administrator to install the SIMATIC NET software. Close all other running
applications, including any antivirus software you may be running.
1. On the SIMATIC NET flash screen, start the installation by clicking Install SIMATIC NET
Software.
2. The PC configuration screen appears. Click Next.
53 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
3. Select the English language option, then click Next. Click Next again.
4. Click yes to the licensing agreement screen.
5. Enter your Name and Company on the User Registration screen.
6. If you already have SIMATIC NET software installed, this will be the drive selected by default.
Clear the Run automatic authorization option, and then click next. The Setup: Configuration
screen appears.
7. Select all application options to be installed. (This is necessary if you do not already have STEP7
installed on your machine. If STEP7 v5.2 or higher is already installed, you do not have to select
the NCM PC/S7 v5.2 application.) Click Next.
8. The applications you selected are installed. At the prompt, click OK to restart your system. The
system restarts and installs the selected applications. Click Finish to restart your system again.
This step involves using the Commissioning Wizard to configure the software you installed in the
previous step.
When your system restarts after the software has been installed, your system's hardware configuration
is scanned. The Commissioning Wizard appears automatically. (You can also access the Commissioning
Wizard at Start/Simatic/SIMATIC NET/Settings/Commissioning Wizard.)
The number of steps required depends on the number of PC Ethernet cards (or modules) detected in
your PC. The more modules you operate in the computer, the more steps are required.
1. Click Next.
An Ethernet Network Card with with the IP addresses settings shown above was found. This is
the network card that will be configured for communication with the Siemens PLC. This is put on
index 5.
Note: The index of the network card can be set with the NCM PC Configuration (hardware
configuration). The station index defaults to 5 if you use the Commissioning Wizard.
2. Select the Use the module for productive operation in configured PC station option, and then
click next.
3. Clear the SIMATIC NET OPC Server in configured PC Station option and select the Configure
more applications option. Then click next.
4. Register the names for your user application: enter VFD1 in the Name text box. This user
application is put on index 1. Click Next.
Note: The name of the application is the VFD name. This comes later in the IFIX Project Editor
under Communication | Ports in the Special options text box.
5. Click Next. This screen appears, confirming you have completed configuring the module:
6. The configuration is saved and the PC station is reconfigured. Your existing configuration data is
overwritten. Click OK to confirm at the prompt.
The next step to configure the project using the PC Station Wizard.
54 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
Note: The Local ID S7-Connection_1 is used later in the IFIX Project Editor under
Communication | I/O Devices in the I/O Device Address text box. This name is case-sensitive
and cannot not contain any spaces.
8. In the Address Details dialog box, enter the card location of the CPU that the SIMATIC S7
communicates with. Here the card location is 2. Click OK.
Note: Some power supplies might occupy 2 slots. If so, the card location of the CPU is one higher
at 3.
9. In the NetPro window the new S7-Connection_1 connection appears. Choose Network | Save
and Compile. The Save and Compile dialog box appears.
10. Select the Compile and check everything option, and then click OK.
11. After completing the save and compile operation, a message appears in the NetPro window. This
indicates the warnings and errors present in the configuration. If warnings occur here, then this is
to be handled as information only. But if errors occur, the project configuration cannot be loaded.
To view errors, choose View |Outputs.
12. Highlight by clicking on the PC Station (TESTXP). Afterwards the connection table disappears in
the message window. From the NetPro menu choose PLC | Download | Selected Stations to
transfer the project configuration to the PC. Alternatively, right-click the PC Station and choose
Download | Selected Stations.
13. To confirm the overwrite of configuration data and to proceed with the download, click Yes.
14. To confirm stopping the Target Module (Network interface Card), click OK.
15. The configuration should now be successfully loaded. Exit NetPro and click next, and next again
to finish the Commissioning Wizard. If you have errors, see for details.
1. The Configuration Console should appear after terminating the Commissioning Wizard. If it
doesn't, open the Configuration Console by selecting START / SIMATIC / Simatic Net /
Settings / Configuration Console.
2. In the Configuration Console dialog box, right-click the Access Point object, and choose New |
New access point.
Note: You can choose any name for the Access point, but it cannot contain spaces and be longer
than 32 characters.
55 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
3. In the New access point dialog box, enter your access point name (this example uses IFIXS7).
Select the hardware component that will be associated with this access point (TCP/IP ->
ASUSTeK/Broadcom 440x in the example).
Note: The access point name is used later in IFIXSCADA in the Project Editor under
Communication | Boards in the Special Options text box. The access point name is
case-sensitive.
After creating the access point the Configuration Console should look like this:
4. Close the Configuration Console.
The IFIX S7 driver needs three names (settings) from the SIMATIC NET software
configuration. The following points are needed:
Note: Do not select the Link I/O Device to an external tag Database option.
The next step in the process is to set the access point of the application.
56 of 57 1/22/2013 3:47 PM
Siemens SIMATIC Step 7 Programmer's Handbook http://www.plcdev.com/book/export/html/373
1. Open the I/O Device dialog box by choosing Communication | I/O Devices.
2. In the Address field enter the name of the connection to the PLC. This example uses
S7-Connection_1.
Variable declaration
Question: I receive the following error message when downloading the PC station in the SIMATIC
NCM PC manager:
"The module "station manager" cannot be contacted. Change the on-line interface."
"For On-line connections via the PC internal interface a station name must be assigned in the
component configurator. This name must be identical to the name of the PC station, as configured
in the STEP7 (or Simatic Net) project."
"Online: No connection could be made. The participant does not announce itself."
Solution
1. Check in SIMATIC NCM PC Manager under the Menu option Options | Set PG/PC Interface,
whether the point of entrance S7ONLINE is linked with the PC internal (local) interface.
2. The Station Configuration Editor tells you whether your module is Online. You can start the
Station Configuration Editor by double-clicking the icon. This should not be OFFLINE, so to
change its mode of operation, click Change Mode. The mode of operation should now change to
ONLINE.
3. Check the station name in the Station Configuration Editor. This must match with the name in
SIMATIC NCM PC Manager. You can change the station name in the Station Configuration
Editor by clicking Station Name.
4. Open the Station Configuration Editor and the SIMATIC NCM PC Manager. Check the order and
the number of configured components and the indexes that are used. These should match.
57 of 57 1/22/2013 3:47 PM