You are on page 1of 8

SIEMENS

DATA BLOCK

SIEMENS
SIMATIC S7 1/14 November 5, 2019
SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Objectives

- Know The Elementary & Complex DB.


- How To Create DB.
- Familiar With Addressing & Accessing Data Element.

SIMATIC S7 2/14 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Accessible to all blocks


Data Blocks (DBs)
Elementary data types (up to 32 bits)
• Bit data types (BOOL, BYTE, WORD,
DWORD, CHAR) Global data
• Mathematical data types (INT, DINT, Function
REAL) FC10
DB20

Complex data types (longer than 32


bits)
• Time (DATE_AND_TIME) OB1 Function
• Array (ARRAY) FC20
• Structure (STRUCT)
• Character chain (STRING) Instance DB for FB1

User-defined data types (longer than 32 Instance data


bits) Function
Data type UDT (User Defined Type) block DB5
FB1

SIMATIC S7 3/14 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Creating a New Data Block

SIMATIC S7 4/14 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Entering, Saving, Downloading and Monitoring a Data Block

Declaration
View

Data View

SIMATIC S7 5/14 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Addressing Data Elements 8 Bits

The number of data blocks 7 0


Data Byte 0 DBB 0
available depends on the CPU
Data Byte 1 DBW 0
you use.
Data Byte 2
The maximum block length is DBD 0
Data Byte 3
8-KByte for the S7-300 and 64-
DBX 4.1
KByte for the
S7-400.

DBD 8188

DBW 8190
Data Byte 8191 DBB 8191

Accessing Data Elements


OPN DB 9 OR A DB9.DBX0.0
A DBX 0.0
OR
OPN DB 9 L DB9.DBB1
L DBB 1
OR
OPN "Values" L DB9.DBW2
T DBW 2

SIMATIC S7 6/14 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Exercise:

1- In FC6, Write a PLC program, using DB6 to calculate the following equation:

K = 4X + 18XZ + 2Z/2 + 2(2Y+3)


Then find the value of K at: X=2, Y=1 and Z=2

SIMATIC S7 7/14 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved
SIEMENS

Answer of Exercise 1:

IN The DB:

The value of K at: X=2, Y=1 and Z=2


K=91

SIMATIC S7 8/14 November 5, 2019


SIEMENS LTD EGYPT 2007
All Rights Reserved

You might also like