0% found this document useful (0 votes)
64 views35 pages

8 Digital Operations

The document discusses digital operations in automation and industrial solutions. It covers data types like INT, DINT, and REAL used in SIMATIC S7 systems. These data types store integer and real number values that can be displayed in different formats. The document also examines how SIMATIC S7 systems acquire process data values, process them, and output results to devices and field controllers.

Uploaded by

haftu gidey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views35 pages

8 Digital Operations

The document discusses digital operations in automation and industrial solutions. It covers data types like INT, DINT, and REAL used in SIMATIC S7 systems. These data types store integer and real number values that can be displayed in different formats. The document also examines how SIMATIC S7 systems acquire process data values, process them, and output results to devices and field controllers.

Uploaded by

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

Digital Operations

F1

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.1
File:
Digital Operations

F1

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.2
File:
Objectives

Upon completion of the chapter the participant will

... be familiar with the INT, DINT, REAL data types and the
BCD display

... be able to apply the selectable display formats in the


"Monitor / Modify Variable" test function

... understand the "Load" and "Transfer" instructions

... be able to apply and program the S5 counter and timer


functions

... understand conversion operations for number formats

... be able to apply and program the comparison


operations

... understand basic mathematical functions

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.3
File:
Acquiring, Processing and Outputting Data

Operating 0248 Thumbwheel


+ monitoring V buttons,
processes Potentiometer
0 8 1 5 , 7-segment
display
Operator Panel

Control such as MPI


Processing
unit the
values

DI/ AI/

DO AO
such as PROFIBUS

Process Field devices


controller

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.4
File:
Integer (INT, 16-Bit Integer) Data Type
Value range -32,768 to +32,767 Arithmetic
(without sign: 0 to 65,535) operations: such as + I, * I, <I, ==I

Display Formats:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

DEC: + 662 BIN.: 2# 000000101001011 HEX: W#16#0 2 9 6


0 without
+29 sign
Sign +2 7
0
6 x 16 = 6
positive +24
numbers +22 9 x 161 = 144
+21 2 x 162 = 512
+ 662 662

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

DEC: - 662 BIN.: 2# 111111010 110101 0 HEX: W#16#F D6 A


without
-215 sign
Sign +2
14

negative +213 10 x 16 =10


0

+212 6 x 161 = 96
numbers +211 13 x 162 = 3328
+210 +28 +26
Representation as +25 +23 +21 15 x 163 =
Twos - 662 61440 64874
complement

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.5
File:
Double Integer (DINT, 32-Bit Integer) Data Type

Value range L# -2,147,483,648 to L#+2,147,483,647 Operations: such as + D, * D, <D, ==D


(without sign: 0 to 4,294,967,295)

Display Formats:
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

DEC: L# +540809 BIN.: 2# 000 0000000010000100000010001001


0
Sign
positive
numbers

HEX: DW#16# 0 0 0 8 4 0 8 9
(without sign)

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

DEC: L# -540809 BIN.: 2# 1111111111110111101111110111011


1
Sign
negative
numbers

Representation as HEX: DW#16# F F F 7 B 7 7


Twos complement F
(without sign)

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.6
File:
REAL (Floating-point Number, 32 Bit) Data Type

Value range -3.402823•10+38 to -1.175495•10-38 , 0.0, +1.175495•10-38 to +3.402823•10+38

Operations: such as + R, * R, <R, ==R


sin, acos, ln, exp, SQR

General format of a Real number = (Sign) • (1 + f) • (2e-127)

Example: 0.75

Sign of
Real no. e = Exponent (8 Bit) f = Mantissa (23 Bit)

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 6 5 4 3 2 1 0
7
0 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
27 26 25 24 23 22 21 20 2-1 2-2 2-3 2-4 ..... 2-23

Real no. = +1.5 * 2 126-127 = 0.75

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.7
File:
The BCD Code for Inputting and Outputting Integers

Value range 16 Bit: - 999 to + 999 Conversion


32 Bit: -9999999 to + 9999999 operations: BTI, BTD, ITB, DTB
(no arithmetic!)

0 2 9 6

16 Bit: BIN.: 2# 0000001010010110

Sign (+) 2 9
HEX: W#16# 0 2 9

Sign 0 0 0 0 2 9
(+)

32 Bit:
BIN.: 2# 0xxx000000000000000000 10100

HEX: DW#16# 0 0 0 0 2 9

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.8
File:
Conversion Operations BCD  Integer

Number Conversion
Entered in BCD
0 81 5 BCD->Integer
Tas User program
with Integer
k
Number math operations
0 2 4 8 Conversion
displaye BCD<-
d in Integer
BCD

LAD FBD STL

BCD_I BCD_I L IW4


EN OUT MW20 BTI
EN ENO
T MW20
IW4 IN OUT IW4 IN ENO
MW20

I_BCD I_BCD L MW10


EN ENO EN OUT QW12 ITB
T QW12
MW10 IN OUT QW12 MW10 IN ENO

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.9
File:
Number Formats

Accessed in between Invalid value !!!

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.10
File:
Loading and Transferring Data

Accumulator 1

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.11
File:
Data Storage in Accumulator 1
Contents of Accumulator 1
Program
31 23 15
7 0
L MB 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 MB0

31 23 15 7 0
Load 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 MB0 MB1
L MW 0

31 23 15 7 0

L MD 0 MB0 MB1 MB2 MB3

T QD 4
QD 4

Transfer T QW 4
QW 4

T QB 4
QB 4

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.12
File:
Comparison Operations

LAD FBD STL

M 3.4 CMP >=I Q 9.7 CMP >=I A M 3.4


A(
IN1 L IW 0
IW0
IN1 L IW 2
IW 0 M 3.4 & Q9.7 >=I
IW 2 IW2 IN2 = )
IN2 = Q 9.7

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.13
File:
Basic Mathematical Functions
LAD FBD STL

ADD_I ADD_I L MW4


Addition EN OUT MW6 L MW10
EN ENO
MW4 MW4 IN1 +I
IN1
MW10 OUT MW6 MW10 ENO T MW6
IN2
IN2
SUB_I SUB_I L MW8
Subtrac- MW6
tion EN ENO EN OUT MW12
MW8 IN1 MW8 IN1 L
OUT MW6 ENO - MW6
MW12 IN2 MW12 IN2 I
T
L MD6
MUL_DI MUL_DI
Multipli- MD66
cation EN ENO EN OUT L MD12
MD6 MD6 IN1 *D
IN1
MD12 IN2 MD66 ENO
T MD66
MD12
IN2
DIV_R DIV_R L MD40
EN OUT MD32
Division EN ENO MD4
MD40 IN1 MD40 IN1 L
OUT MD32 MD4 ENO / MD32
IN2 IN2 R
MD4
T
SIMATIC S7 Date 2/4/2012 SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.14
File:
S5 Counter Functions
LAD FBD STL

A I 0.4
C5 C5
CU C5
S_CUD S_CUD
I 0.4 Q 8.3 A I 0.5
CU Q
Q I 0.4 CU CD C5
A I 0.3
I 0.5
L C#5
CD CV MW 4 I 0.5 CD
S C5
I 0.3 A I 0.7
S CV_BCD QW 12 I 0.3 S CV MW 4 R C5
L C5
C#5 PV C#5 PV CV_BCD QW 12 T MW4
Q 8.3 LC C5
I 0.7
R I 0.7 R Q
Q = T
QW12
A C5
= Q8.3

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.15
File:
Counters: Function Diagram

CU

CD

5
4
3
Count
2
1
0

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.16
File:
Exercise 1: Counting the Transported Parts (FC 18, C 18)

DI DO
I 0.0 T_System_ON Act Quantity
I 0.1 T_System_OFF L_SYSTEM Q 4.1
I 0.2 T_Jog_RIGHT L_MAN Q 4.2
I 0.3 T_Jog_LEFT Q 4.3 V

I 0.4 S_M/A_ModeSelect L_AUTO


I 0.5 T_M/A_Accept "QW_DigDisp" (QW 6)
-15V...+15V -15V...+15V
AI2 AO1
AI1 AO2

AI1 AI2
V

0 8 1 5 AI1 AI2 AO1 AO2

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.17
File:
S5 Timer Functions
T44 T44
S_PULSE S_PEXT
I 0.7 S MW0 I 0.7 S BI MW0
S5T#35s BI QW12 S5T#35s QW12
M8.5 TV BCD M8.5
I 0.5 TV BCD = I 0.5 =
R Q
R Q
Pulse Timer (SP) ON Delay (SD) Extended Pulse (SE)
T44
S_ODT
I 0.7 S BI MW0
S5T#35s QW12
TV BCD M8.5
I 0.5 R Q =
Stored ON Delay (SS) OFF Delay (SF)
T44 T44
S_ODTS S_OFFDT
S BI MW0 MW0
I 0.7 I 0.7 S BI
S5T#35s QW12 S5T#35s QW12
TV M8.5 TV M8.5
I 0.5 BCD = I 0.5 BCD =

R Q R Q
SIMATIC S7 Date 2/4/2012 SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.18
File:
Timers: ON Delay (SD)
LAD FBD STL

T4 T4
I 0.7 S_ODT Q8.5 S_EVERZ A I 0.7
S Q I 0.7 S BI MW0 L S5T#35s
S5T#35s BI MW0 S5T#35s QW12
SD T4
TV T BCD
I 0.5 Q8.5 A I 0.5
V
R BCD QW12 I 0.5 Q = R T4
R L T4
T MW0
RLO at S
LC T4
RLO at R T QW12
A T4
Time = Q8.5
operation
Example

Data type 0.01s <-- 0 0


0.1s <-- 0 1
1s <-- 1 0 Units of time: 0 to 999 (BCD-coded)
“S5TIME” 10s <-- 1 1

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.19
File:
Exercise 2: Monitoring the Transport Functions (FC 17)

DI DO

I 0.0 T_System_ON
I 0.1 T_System_OFF L_SYSTEM Q 4.1
I 0.2 T_Jog_RIGHT L_MAN Q 4.2
I 0.3 T_Jog_LEFT L_AUTO Q 4.3
I 0.4 S_M/A_ModeSelect
I 0.5 T_M/A_Accept

T_Ackn L_Conv
_Fault _Fault

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.20
File:
Exercise 3: Counting the Transported Parts (FC 19)

DI DO SETPOINT Quantity ACTUAL Quantity


I 0.0 T_System_ON
I 0.1 T_System_OFF L_SYSTEM Q 4.1 0 8 1 5
I 0.2 T_Jog_RIGHT L_MAN Q 4.2
I 0.3 T_Jog_LEFT L_AUTO Q 4.3
I 0.4 S_M/A_ModeSelect "IW_Thumbw" (IW 2) "QW_DigDisp" (QW 6)
I 0.5 T_M/A_Accept

T_Ackn_Fault L_Conv_Fault

ACT=SET Acknowledgement
"L_Bay-LB" (Q 8.4) "T_Bay-LB" (I 8.4)

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.21
File:
Exercise 3: Counting the Transported Parts (FC 19), Solution Hints
NW 1: Set "Counter" to
0
MOVE
Condition
for resetting EN OUT MW 20
0 IN ENO

NW 2: Counting via memory word, ACT


quantity
ADD_I
Rising edge of
counting event EN

MW 20 IN1 OUT MW 20

1 ENO

IN2
NW 3: Display ACT quantity on the BCD digital display

Convert ACT quantity (MW 20) from Integer to BCD -> Result on BCD digital display (QW 6)

NW 4: Read in SETP quantity and convert from BCD to Integer

Convert value from thumbwheel button (IW 2) from BCD to Integer -> Store SETP quantity (Integer) in MW 22

NW 5: ACT-SETP comparison, Conveyor indicator light Q 8.4

Compare ACT (MW 20) to SETP (MW 22) -> Place comparison result on indicator light

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.22
File:
If You Want to Know More

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.23
File:
Additional Exercise 4: Counting the Conveyor Belt Faults (FC17)

Conv
Fault
M 17.0

3
Conv
2
Fault 1
Coun
0
ter C
17

M/A AUTO
Q 4.3

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.24
File:
Additional Ex 5: Timely Lock-out of the Conveyor Motor Jogging

Lock-out
time LEFT

Jog RIGHT

I 0.2
Conv motor
RIGHT
(Q8.5)
Lock-out
RIGHT
T 15 (SF)

Jog LEFT
I 0.3
lock-out
time RIGHT
Conv motor
LEFT
(Q8.6)

Lock-out
LEFT
T 16
(SF)

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.25
File:
Counters: Bit Instructions
LAD FBD STL

Network 1: C5
I 0.0 SC
I 0.0 C5
A I 0.0
SC L C#20
C#20 CV
C#20 S C5
Network 2:
C5
I 0.1 C5
I 0.1 CU A I 0.1
CU
CU C5

Network 3:
I 0.2 C5 C5
A I 0.2
CD I 0.2 CD CD C5

Network 4:
C5 Q 4.0 Q 4.0
A C5
C5 = = Q 4.0

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.26
File:
Timers: Stored ON Delay (SS)
LAD FBD STL

T4 T4 A I 0.7
I 0.7 S_ODTS Q8.5 S_ODTS L S5T#35s
S BI MW0 SS T4
S Q I 0.7
S5T#35s BI A I 0.5
TV MW0 S5T#35s TV BCD QW12
Q8.5 R T4
I 0.5
R I 0.5 R L T4
BCD QW12 Q =
T MW0
LC T4
T QW12
A T4
= Q8.5

RLO at S

RLO at R

Timer
operation
Example

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.27
File:
Timers: Pulse (SP)
LAD FBD STL

T4 T4 A I 0.7
I 0.7 S_PULSE Q8.5 S_PULSE L S5T#35s
S Q S BI MW0 SP T4
I 0.7
A I 0.5
S5T#35s TV MW0 S5T#35s QW12
T BCD R T4
I 0.5 BI Q8.5
QW12 V L T4
R BCD I 0.5 Q =
T MW0
R
LC T4
T QW12
A T4
= Q8.5

RLO at S

RLO at R

Timer
operation
Example

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.28
File:
Timers: Extended Pulse (SE)
LAD FBD STL

T4 T4 A I
I 0.7 S_PEXT Q8.5 S_PEXT 0.7 L
S Q I 0.7 S BI MW0 S5T#35s
S5T#35s TV BI MW0 SE T4
S5T#35s QW12 A I 0.5
I 0.5 TV BCD Q8.5
R BCD QW12 I 0.5 R T4
=
R Q
L T4
T MW0
LC T4
T QW12
A T4
=
RLO at S Q8.5

RLO at R

Timer
operation
Example

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.29
File:
Timers: OFF Delay (SF)
LAD FBD STL

T4 T4 A I 0.7
I 0.7 S_OFFDT Q8.5 S_OFFDT L S5T#35s
S Q S B MW0 SF T4
I 0.7
S5T#35s BI A I 0.5
TV MW0 S5T#35s T BCD
I QW12
Q8.5 R T4
I 0.5 V
R I 0.5 L T4
BCD QW12 Q =
R T MW0
LC T4
T QW12
A T4
= Q8.5

RLO at S

RLO at R

Timer
operation
Example

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.30
File:
Time Formats for Traditional S5-Timers in STEP 7

Time specifications as constants


S5T#35s200ms
(Time base: 01 (100ms), Number of units of time: 352)

01 3 5 2

Time specifications per variable X X 0 1 0 0 1 1 0 1 0 1 0 0 1 0

Time base Units of time (BCD-coded)

29 28 27 26 25 24 23 22 21 20
Accu 1 contents after “L T...” exec. X X X X X X 0 1 0 1 1 0 0 0 0 0

Residual units of time (Integer)

01 3 5

2
Accu 1 cont. after “LC T...” exec. X X 0 1 0 0 1 1 0 1 0 1 0 0 1 0

Time base Residual units of time (BCD-coded)

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.31
File:
Timers: Bit Instructions
LAD FBD STL

Network 1:
T4
I 0.0 T4 I 0.0 & SD A I 0.0
SD L S5T#5s
S5T#5s TV SD T4
S5T#5s

Network 2:

T4 Q 8.0 Q 8.0
A T4
T4 & =
= Q 8.0

Network 3:
T4
I 0.1 T4 A I 0.1
R I 0.1 & R R T4

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.32
File:
Conversion Operations I  DI  REAL

Data in integer format


(16-bit integer)

Conversion from Conversion from Math


Tas integer to double integer program
double integer to real number with
k
real
number
s

F STL
I_DI
EN OUT MD14
B DI_R
ENO EN OUT MD26
D MW12 IN L MW12
LAD ENO ITD
MD14 IN
DTR
T
I_DI DI_R
MD
EN ENO EN ENO
26

MW12 IN OUT MD14 MD14 IN OUT MD26

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.33
File:
Digital Logic Operations

WXOR_W L IW 0
WOR_W
L W#16#5F2A
WAND_W
AW / OW / XOW
EN ENO
T MW10
IW0 IN1
OUT MW10 15 0
W#16#5F2A IN2
IW0 = 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0

W#16#5F2A = 0 1 0 1 1 1 1 1 0 0 1 0 1 0 1 0

AND OR XOR

0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0
MW10 after “AW” ex.

0 1 0 1 1 1 1 1 0 0 1 1 1 0 1 0
MW10 after “OW” ex.

0 0 0 1 1 1 1 1 0 0 0 1 1 0 0 0
MW10 after “XOW” ex

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.34
File:
Application Example: Digital Edge Detection

SIMATIC S7 Date 2/4/2012 SITRAIN Training for


Automation and Industrial Solutions
Siemens AG 2006. All rights reserved. : PRO1_08E.35
File:

You might also like