100% found this document useful (1 vote)
505 views12 pages

Data Blocks in Simatic Step 7 Siemens

This document discusses data blocks in Siemens Simatic Step 7 PLC programming. It describes that data blocks can save up to 8KB of data in the CPU and there are two types: global and instance. Global DBs allow all program objects to read and write data while instance DBs are assigned to a particular function block. The document also provides information on addressing data elements in DBs and the different data types that can be saved, such as BOOL, BYTE, WORD, etc. It concludes by describing how to generate new data blocks in a Simatic S7-PLCSim project.

Uploaded by

Ahmed Alnagar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
505 views12 pages

Data Blocks in Simatic Step 7 Siemens

This document discusses data blocks in Siemens Simatic Step 7 PLC programming. It describes that data blocks can save up to 8KB of data in the CPU and there are two types: global and instance. Global DBs allow all program objects to read and write data while instance DBs are assigned to a particular function block. The document also provides information on addressing data elements in DBs and the different data types that can be saved, such as BOOL, BYTE, WORD, etc. It concludes by describing how to generate new data blocks in a Simatic S7-PLCSim project.

Uploaded by

Ahmed Alnagar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

10/1/2015 Data 

Blocks in Simatic Step 7 Siemens

‫ﺍﻟﺩﺧﻭﻝ‬ ‫ ﺗﺳﺟﻳﻝ‬  ‫ﺇﻟﻛﺗﺭﻭﻧﻳﺔ‬ ‫ﻣﺩﻭﻧﺔ‬ ‫ﺇﻧﺷﺎء‬ «‫ﺍﻟﺗﺎﻟﻳﺔ‬ ‫ﺍﻹﻟﻛﺗﺭﻭﻧﻳﺔ‬ ‫ ﺍﻟﻣﺩﻭﻧﺔ‬   ‫ ﺍﻟﻣﺯﻳﺩ‬  ۳

PLC, SCADA, Automation, PLC Programming, PLC eBook, Free PLC Training
Home Donate Download Get Free PLC eBook Contact Us Youtube Facebook Twitter Google+ Privacy Policy

We are so proud for every donation. Thank you.
Data Blocks in Simatic Step 7 Siemens
Data Blocks (DBs) can be used by your program to save data in the CPU. Your hard disk  

contains up to 8 Kbytes(8192Bytes) space. There are two types of data blocks. Global
▼ ​
‫ﺍﻟﻠﻐﺔ‬ ‫ﺗﺣﺩﻳﺩ‬
DBs, where all OBs, FBs and FCs read all saved data or can even write in the DB and
local instance DBs, which are assigned a particular FB. In the DBs, different data types
(e.g. BOOL or WORD) can be saved in arbitrary order. This structuring of a DB follows Search this site...   Search

through input in a table with the tool LAD, STL, FBD ­ S7 Block Programming.
In the program structure from STEP 7, data blocks are found as follows: Popular Posts

Get Economical
Solutions To Basic
Control Needs With
Micro And Nano Allen­
Bradley Control Systems

Alert / Signal Lamp For
Forex Trading Using
PLC, MetaTrader And
Visual Basic
Figure 1 Data Blocks

Data blocks are generated and opened like program blocks in the tool LAD, STL, FBD: Take Many Benefits Use
Programblocks. They serve e.g. for the saving of data and system states. Allen­Bradley GuardPLC
1600 Safety Controller
For Interfacing With
Safety Components

Android Phone,
ESP8266 Serial WiFi,
Arduino And PLC
Modbus Application

Siemens S7­200 PLC
Figure 2 Addressing Data elements And Computer (Laptop)
http://program­plc.blogspot.com.eg/2015/09/data­blocks­in­simatic­step­7­siemens.html 1/12
10/1/2015 Data Blocks in Simatic Step 7 Siemens

Communication With
Visual Basic Express
Before create Data Blocks (DBs), we must understand about addressing Data in Simatic And Windows 7
Step7. Figure 2 show the addressing data elements in Simatic Step7. There is 3
elementary data type:
Bit data Type (Bool, Byte, Word, DWord, Char)
Mathematical data type (Int, Dint, Real)
Time types (s5Time, Time, Date, Time_of_Day)
In the figure 2, 1 box represent 1 Bit memory. 1 Bool have length 1 Bit, and 1 Byte have
length 8 Bit. For more detail you can see in table below
Size in Bit Range and Number Notation
Type
Bool 1 True/False
Byte 8 B#16#0 to B#16#FF
Word 16 W#16#0 to W#16#FFFF
DWord 32 DW#16#0000_0000 to DW#16#FFFF_FFFF
INT 16 ­32768 to 32767
1 2 3 4
DINT 32 ­2147483648 to 2147483647
Real 32 Upper Limit +/­ 3.402832e+38 
Lower Limit +/­ 1.175495e­38
S5Time 16 S5T#0H_0M_0S_10MS to
S5T#2H_46M_30S_0MS and
S5T#0H_0M_0S_0MS
Time 32 T#24D_20H_31M_23S_648MS
to
T#24D_20H_31M_23S_647MS
Date 16 D#1990­1­1 to
D#2168­12­31
Time_Of_Day 32 TOD#0:0:0.0 to
TOD#23:59:59.999
Char 8 A, B, etc.

How to Generate Data Blocks (DBs) in Simatic S7­PLCSim

Step 1: Create New Project
Follow Step 1 to Step 3 of the article about Learning PLC Programming With SIMATIC S7­
PLCSIM
Start from  Step 1: Setup PG/PC Interface, Step 2: Create New Project and Step 3: Add
Station Object

Step 2: Insert S7 Program

http://program­plc.blogspot.com.eg/2015/09/data­blocks­in­simatic­step­7­siemens.html 2/12
10/1/2015 Data Blocks in Simatic Step 7 Siemens

Insert a new S7­Program, in INSERT menu select PROGRAM and then S7 PROGRAM

Figure 3 Insert S7 program

Step 3: Insert Data Block
Highlight the folder Block

Figure 4  Folder Block

Insert Data Block, in INSERT menu select S7 Block and then Data Block

Figure 5 Insert Data Block

Enter the number for Data Block in Name and type (in this case I set DB1), choose Shared
DB so DB can accessed by another program. For Symbolic Name and Symbolic

http://program­plc.blogspot.com.eg/2015/09/data­blocks­in­simatic­step­7­siemens.html 3/12
10/1/2015 Data Blocks in Simatic Step 7 Siemens
Comment is optional. Accept with OK

Figure 6 Data Block

Step 4: Create Data variable
Open the data block DB1 with double click or open object.

Figure 7 Data Block DB1

The Data Block is generated with a symbol Name. The Type, an Initial value as well as
aComment (optional) are entered.The address is automatically generated and cannot be
altered. In Data

Figure 8 Program Block for Data Block

http://program­plc.blogspot.com.eg/2015/09/data­blocks­in­simatic­step­7­siemens.html 4/12
10/1/2015 Data Blocks in Simatic Step 7 Siemens
Fill the Data Block like figure below, Click save for save all changes.

Figure 9 Data Block

Step 5: Store data into Data Block
Now we create program to write data to Data Block, in simatic manager double click on
OB1. When Properties – Organization Block Window open choose LAD in Created in
Language. Click OK.

Figure 10 Open program Block

Figure 11 Organization Block Properties

Expand folder counter in library, select S_CU function and drag to, main window.

http://program­plc.blogspot.com.eg/2015/09/data­blocks­in­simatic­step­7­siemens.html 5/12
10/1/2015 Data Blocks in Simatic Step 7 Siemens

Figure 12 Insert S_CU Function

Figure 13 Insert S_CU Function

Function Description
Data Type Memory Area Description
Parameter
C no Counter C Counter Identification Number
CU BOOL I,Q,M,L,D Count up input
S BOOL I,Q,M,L,D Set Input for Presetting counter
PV Word I,Q,M,L,D, or Enter Counter value as C#<value> in the
Constant range from 0 to 999
R BOOL I,Q,M,L,D Reset Input
CV Word I,Q,M,L,D Current Counter Value, hexadecimal number
CV_BCD Word I,Q,M,L,D Current Counter Value, BCD coded
Q BOOL I,Q,M,L,D Status of the Counter.

In this case, we will not use all parameter in S_Cu Function. We only use Input counter CU
and Counter Value CV for store data in DB1. Create program like figure below

http://program­plc.blogspot.com.eg/2015/09/data­blocks­in­simatic­step­7­siemens.html 6/12
10/1/2015 Data Blocks in Simatic Step 7 Siemens

Figure 14 Counter Function

Step 6: Simulation
Save and close program object window. Run PLCSim with click on PLCSim icon.

Figure 15 PLCSim

And create input output variable for IB 0 (Input), C 0 (Counter), and DB1.DBW0 (Data
Block).

Figure 16 PLCSim ON

Download program

Figure 17 Download Program

http://program­plc.blogspot.com.eg/2015/09/data­blocks­in­simatic­step­7­siemens.html 7/12
10/1/2015 Data Blocks in Simatic Step 7 Siemens

Run simulation

Figure 18 Run Simulation

Figure 19 Simulation Store data in DB

Set IB 0.0 to 1, and see counter in C 0 count 1 and counter store data into DB1.DBW0. Set
IB 0.0 to 0 and repeat set IB 0.0 to 1 again, see the count in counter increase and store to
DB1.DBW0.

Step 7: Data View Mode in Data Block
Double click on DB1 in Simatic manager, to open DB1 editor

Figure 20 Open DB1

http://program­plc.blogspot.com.eg/2015/09/data­blocks­in­simatic­step­7­siemens.html 8/12
10/1/2015 Data Blocks in Simatic Step 7 Siemens

In VIEW menu select Data View, 

Figure 21 Data View

Select Monitor mode

Figure 22 Monitor mode

And check data in DB1 in PLCSim and Program Object Data Block, it must be same. 

Figure 23 Data Block Monitor

Download project file click here
Video Demonstration: Data Blocks in Simatic Step 7 Siemens

http://program­plc.blogspot.com.eg/2015/09/data­blocks­in­simatic­step­7­siemens.html 9/12
10/1/2015 Data Blocks in Simatic Step 7 Siemens

Labels: PLC , PLC Articles , PLC Simulator , Siemens PLC
Posted by Cartiman Iman 
Home Next Article
► take many benefits use allen bradley

♥ Favorite Labels ♥
♥ PLC Simulation
♥ PLC Articles
♥ PLC Application
♥ SCADA Articles
♥ Product News
♥ PLC Simulator
♥ Automation
♥ SCADA Application

..
l ease .
t p
h a re i share share share share
S

You might also like:

Modbus Programming Timer How to use FC105 Siemens S7­200 PLC PPI Multi­Master


Communication of Allen Bradley ... SCALE and FC106 and Computer (La... Cables and STEP 7 ...
between CNC an... UN...

You may also like these ebook:

http://program­plc.blogspot.com.eg/2015/09/data­blocks­in­simatic­step­7­siemens.html 10/12
10/1/2015 Data Blocks in Simatic Step 7 Siemens

Get Free PLC eBook directly sent to your email,
and email subscription to program­plc.blogspot.com

 Enter your email here

 Submit PLC eBook to My Email   

We hate SPAM. Your information is never sold or shared with anyone.

Has been downloaded

Click for Random Post

http://program­plc.blogspot.com.eg/2015/09/data­blocks­in­simatic­step­7­siemens.html 11/12
10/1/2015 Data Blocks in Simatic Step 7 Siemens

Powered by Blogger.

http://program­plc.blogspot.com.eg/2015/09/data­blocks­in­simatic­step­7­siemens.html 12/12

You might also like