You are on page 1of 54

‫لتحميل المزيد من الكتب والمراجع باللغة العربية‬

‫تابعونا على‬

‫صفحة موسوعة الهندسة الكهربية على الفيس بوك‬


‫‪Electrical Engineering Encyclopedia-Arabic‬‬
‫‪www.facebook.com/EEE.Arabic‬‬
‫‪-------------------------------------------------------‬‬
‫جروب موسوعة الهندسة الكهربية على الفيس بوك‬
‫‪EEE-Arabic‬‬
‫‪www.facebook.com/groups/EEE.Arabic‬‬
Siemens S7 300,400
Shift and Rotate Instructions
"# $ !

hassanheha@yahoo.com

http://hassanheha.forumn.net
You can use the Shift instructions to move the contents of the low word of
accumulator 1 or the contents of the whole accumulator bit by bit to the left or the
right (see also CPU Registers)

% & ACCU1 #$ ACCU1-L ! " Shift instructions


' ( ) #$ () %&

Shifting by n bits to the left multiplies the contents of the accumulator by ”2 n+*

n5 , - 24 ACCU1 ! " /01 2 - 3 ()n % & , -.

shifting by n bits to the right divides the contents of the accumulator by ”2 n *

n5 , - ( ACCU1 ! " 62- ()n % & , -.

For example, if you shift the binary equivalent of the decimal value 3 to the left by
3 bits, you end up with the binary equivalent of the decimal value 24 in the
accumulator

5A@?>: ;! < ;=4 3 %&:, : 760 ) 89"

If you shift the binary equivalent of the decimal value 16 to the right by 2 bits, you
end up with the binary equivalent of the decimal value 4 in the accumulator

A@A BC ;! < ;=4 () % & BC 760 ) #

The number that follows the shift instruction or a value in the low byte of the low
word of accumulator 2 indicates the number of bits by which to shift

%&, F9 ACCU2-L ! " #$ shift instruction 2 DE 760

The bit places that are vacated by the shift instruction are either filled with zeros or
with the signal state of the sign bit (a 0 stands for positive and a 1 stands for
negative G

M' N %& ! . #$ ' LOP. ") QR " 7 shift instructions H 0I JK 0L 7 2 %


## S! 0LO
The bit that is shifted last is loaded into the CC 1 bit of the status word. The CC 0
and OV bits of the status word are reset to 0

CC0 , OV " FV 0 LW 7 24 CC1 24 J ) 7 % & 0&T U 7

You can use jump instructions to evaluate the CC 1 bit

CC1 ! "(), X . Jump instructions

The shift operations are unconditional, that is, their execution does not depend on
any special conditions

RLO %( 3 DP. - X

They do not affect the result of logic operation

RLO ( 0YR X#

The following Shift instructions are availableZ


[SSI Shift Sign Integer (16-Bit)
[SSD Shift Sign Double Integer (32-Bit)
[SLW Shift Left Word (16-Bit)
[SRW Shift Right Word (16-Bit)
[SLD Shift Left Double Word (32-Bit)
[SRD Shift Right Double Word (32-Bit)
%&'
; ]' ; 6 ^ _#0& #$ 3!&, ; V ` ! Analogue 0\ 'N " F" -

+)Bd ( ) d G #$ f gBd ( ) eBd G a !4 ; V ` ! .0J M'!W 24 2S' F" - . b 3#c


RTD #$ FhV!"0Y M' N) M'!O 24 ; V #$ a !4 2 " ; V #$ f 0 h"$ 2 " 5d ( ) d G 0 h"$ 2 " ; V #$
PLCi !%$ 4 V 24 J-" F" - O & Modules J i !%c jEQ F 4

m . Analogue inputs D0\ 3!& . O & SM331 i !%c k! 89" l 24#


Modules " m " i!% S! ' N i !%$ " i!% F # ^ !%$

O 6'$ M'!O 24 J-" F" - 7 Analogue inputs i !%$ F 4 PLC F& , "$

: n M'!W . F" - ; ! ;! #

PIW 8&
PQW S0

Hardware configuration jo p ) 7 8 " 6' E&P #

7 ^%=4 3!&, ' N) A , ( D! D$ Analoge input module 4 channels _ ',) 89 4


;! q a . ? , , " .# JW W 7 Byte 3#$ " . 3!& ! Addresses ` p )
a . 5 , F&, F

Properties H 0I EQ 7 # F& r X ;$ s0 . t"0h hu' . Addresses 0 K #


Hardware configuration24

' Nv _#0 # 3!& " F" - Functions 3 #, l " 2 Oc t" %0h 24 S! EV


/! p F . Scaling F J 4 7 q 0I

a6! lL% 24 Scaling F # 8& M` 0< FC106 89" 2Q#

( , X. . FV F 7 ;$ ( f F L ( 0"c H 0I M0N h" J ` 06 EV


wN FV 24 " t"0h

FY 0LO 89" F& <hI Module / O Properties H 0I 6'x 7 6 (W6$ 40-" #


E Q# a !4 Bd FY 5yCA? 760 # a !4 0LO

M0N h" PQW ( ) T 0"c H 0I Analogue _0& ( ) < F<% EV

: 0< 2 n 3 9 z0 L%
'! !" j | L" { Q# a !4 Bd ( ) 0LO " 0 K PIW 324 ( ) O!" M0 K " "# <" { Q
j 8 <hI PLC " _0&X M' N) 0 K D$ Reference H 0I '! ! j l /! p #
PQW 334_0 ( PLC _#0& ;! #

0 u ; V ~)# S!" ;! _0 ;=4 B ; V ~=4 Input I0.1 ( j X . } | L ;$ z 0 4 .


;! _0 ;=4 ,!S!"

AN I 0.1
JC m001
L PIW 324
T PQW 334
JU m002
m001 : L PIW 324
L -1
*I
T PQW 334
m002 : BEU

" O 3 # # Analogue ' N " F" - 8 M'# " F" V `US , 04) 7 k!
• ` N ;) J-" F" - 2 # l
Shift Sign Integer (16-Bit) : SSI

€ O 76' j -. ;! ;$ #$ •<4 SSI ;! ;$ ") '!O E&P 0"c EQ#

#$ 0"c -. 2 P DE 760 D# % " , -. ACCU1-L ! ) F -. !< !Q#


D$ f 0LW " F6$ G 760 ; V ~=4 M' N % & ' h X 24 1! " ACCU2-L-L ! .
; V ~)# 3 " J )7 2 % FV 24 f B G 760 1# 7 4 f B G D! M' N ; & ;$
0&T 1# " ' ( J )7 2 % 24 f d G 1# 7 4 f 0LW " 0hV$ G S!" 760
Status word % & " CC1 24 J ) 7 Bit % &

; V ~) f FFFF#16 G 2p- # S!" 760 ; V ~) f BC‚dddd G 2p- % & BC 76' ) ;=4 2 .#


760 ! 0ƒ ;#, 760

SSI 3 - . 7 2 Shifting F N €1! 2 F #

3 9" :
L MW4
//Load value into ACCU1//
SSI 6
//Shift bits with sign in ACCU1 six places to the right//
T MW8
//Transfer result to MW8//

5e3 9"

L +3
//Load value +3 into ACCU1//
L MW20
//Load contents of ACCU 1 into ACCU 2. Load value of MW20 into ACCU1//
SSI
//Shift number is value of ACCU2-L-L => Shift bits with sign in ACCU1-L//
//three places to the right; fill free places with state of sign bit//
JP NEXT
//Jump to NEXT jump label if the bit shifted out last (CC 1) = 1//
Shift Sign Double Integer (32-Bit) : SSD

! " ) 7 q % & :5 „! " ( # " H. 0"c LO !" lL% 0"c EJ #


24 ACCU2-L-L ! " <. #$ 0"c 2 DE 760 D# % & , -. F" .ACCU1
760 ; V ~=4 M' N % & ' h X 24 1! " j -. 76' 0V~ ;#, •<4 SSD K W . 0"c
760 1# 7 # 2 Oc 760 3 N F JK 0L 2 % 24 f B G 760 1# 7 0LW " F6$
CC1 24 J ) 7 % & 0&T 6 1# " 0LW " 0hV$ S!" 760 24 f d G

( FFFFFFFF ) #$ hS!" ; V ~) f dddddddd G ") ^ t % & :5 , -. 760 ) ;=4 2 .#


h ; V ~)

SSD . Shift F 7 " F9 2 F #

L MD4
Load value into ACCU 1
SSD 7
Shift bits in ACCU 1 seven places to the right, according to the sign
T MD8
Transfer result to MD8

5e 3 9"

L +3
Load value +3 into ACCU 1
L MD20
Load contents of ACCU1 into ACCU2 Load value of MD20 into ACCU1
SSD
Shift number is value of ACCU2-L-L => Shift bits with sign in ACCU1 three
places to the right, fill free places with state of sign bit
JP NEXT
Jump to NEXT jump label if the bit shifted out last ( CC 1) = 1
Shift Left Word (16-Bit) : SLW

#$ 0"c 2 DE 760 D# % & , -. 3 ( ) ACCU1-L ! " =. 0"c EQ !<


ƒ 8" " JK 0L 7 2 % 24 f d G 1# 7 # ,0L " 0"c ` S ~) ACCU2-L-L ! .
7 % & 0&T 6 1# 7 # ( Unsigned integer ) M' N 0ƒ …K. ;! Q F" - ;$
Status word % & 24 CC1 24 J )

; V ~)# ACCU1-L ! <V f dddd G 1# 7 ^%=4 % & BC 760 ) 7 ~) ^%$ 2 - EQ#


no-operationD$ NOP ^%$ ( 0"c " F" - 7 ^%=4 f d G 0LO SLW , SSI , SSD -. 760

ACCU1 ! " ( SLW 0Y$ €1! 2 F

Be 3 9"
[left]
L MW4
Load value into ACCU1
SLW 5
Shift the bits in ACCU1 five places to the left
T MW8
Transfer result to MW8

5e 3 9"

L +3
Load value +3 into ACCU1
L MW20
Load contents of ACCU1 into ACCU2. Load value of MW20 into ACCU1
SLW
Shift number is value of ACCU2-L-L => Shift bits in ACCU1-L three places
to the left
JP NEXT
Jump to NEXT jump label if the bit shifted out last (CC 1) = 1
Shift Right Word (16-Bit) : SRW

#$ SRW 0"c -. 760 D# " % & , -. ( ) ACCU1-L ! " ) 7 0"c EQ 24


" F" - 7 Q q ' LOP. JK 0L 7 2 % `F" " ACCU2-L-L ! " D# , -.
CC1 24 J ) 7 % & 0&T 6 1# 7 # Unsigned integer M' N) ;# . ^%$ ( 760

ACCU1-L ! " ;=4 % & BC ' < . ACCU1-L 24 ,!S! 760 ) 7 ~) ^%$ ƒ 8" "
CC0=0 , CC1=0 , OV=0 ;=4 EV f dddd G €hW

ACCU1-L ! " ( SRW 0 YP €1! M'!W

Be 3 9"

L MW4
Load value into ACCU1
SRW 6
Shift bits in ACCU1-L six places to the right
T MW8
Transfer result to MW8

5e 3 9"

L +3
Load value +3 into ACCU1
L MW20
Load contents of ACCU1 into ACCU2. Load value of MW20 into ACCU1
SRW
Shift number is value of ACCU2-L-L => Shift bits in ACCU1-L three places
to the right
SPP NEXT
Jump to NEXT jump label if the bit shifted out last (CC 1)=1
Shift Left Double Word (32-Bit) : SLD

#$ 0"c 2 DE , - < D# " % & , -. 3 ( ) ACCU1 ! " =. 0"c EQ !<


U % ; " ' LO$ 1# " ,0L " 0"c ` S ~) ACCU2-L-L ! " < D# "
CC1 24 J ) 7 % & 0&T 6 1##

EV# 0LO €hW ACCU1 ! " 6 ;=4 SLD 3 - . 3 ( ) % & :5 76' ) 7 ~)#
CC1=0 , CC0=0 , OV=0

wNX D$ NOP ^%$ ( 0"c " F" - 7 0LO %&, ; V ~)#

M'!W ACCU1 ! " ( SLD 0 YP 40- #

Z 9"$

Example 1

L MD4
Load value into ACCU1
SLD 5
Shift bits in ACCU 1 five places to the left
T MD8
Transfer result to MD8

Example 2
L +3
Load value +3 into ACCU1
L MD20
Load the contents of ACCU1 into ACCU2
Load value of MD20 into ACCU1
SLD
Shift number is value of ACCU2-L-L => Shift bits in ACCU1 three places
to the left
JP NEXT
Jump to NEXT jump label if the bit shifted out last CC1=0
Shift Right Double Word (32-Bit) : SRD

#$ 0"c 2 DE 760 D# " % & , -. ( ) F" . ACCU1 ! " =. 0"c EQ !<


0&T 6 1## U % ; " ' LO$ 1# " ,0L " ` S ~) ACCU2-L-L ! " <.
CC1 24 J ) 7 % &

EV# 0LO ACCU1 ! " €hW % & :5 , -. ACCU1 ! " ) 7 ~) ^%$ ƒ 8" "
CC1 , CC0 , OV

ACCU1 ! " ( SRD 0 YP €1! M'!W

Z 9"$

Example 1

L MD4
Load value into ACCU1
SRD 7
Shift bits in ACCU1 seven places to the right
T MD8
Transfer result to MD8

Example 2

L +3
Load value +3 into ACCU1
L MD20
Load contents of ACCU 1 into ACCU 2. Load value of MD20 into ACCU1
SRD
Shift number is value of ACCU2-L-L => Shift bits in ACCU1 three places
to the right
JP NEXT
Jump to NEXT jump label if the bit shifted out last (CC 1)=1
ACCU1 '(

Shift - Y " 2Q# #$ 3 ACCU1 ! " 0 # 0" #c jEQ


J )7 2 % . x JK 0L 7 2 % ;$ 0 u

0"c ( $ ~) "$ 0"c 2 DE 760 D# " % & , -. 7 0 # ;=4 F9"#


ACCU2-L-L ! D# " % & , -. 7 0 # ;=4 j -. 76' ;# .

† $ Shift F9" Status word 24 CC1 % . % - X . 7 0 # ;=4 EV

0# - M04! 0" #c

RLD Rotate Left Double Word 32-Bit


RRD Rotate Right Double Word 32-Bit
RLDA Rotate ACCU 1 Left via CC 1 32-Bit
RRDA Rotate ACCU 1 Right via CC 1 32-Bit
( ) *(+ , - .

Rotate Left Double Word (32-Bit) : RLD

( ( $ ~) ^ DE 760 D# " % & , -. 3 % ACCU1 ! "0# 0"c EQ F -


Z2n F

RLD <number> , <number> : number of rotatr bits

7 # ACCU2-L-L ! D# " % & , -. 0 # 7 4 RLD F . ,0L " ( $ ~) ")


a % 7 <. % " JK 0L 7 2 % `F" 7 # CC1 24 Q0 # 7 % & 0&T U
3 % " J )7

; V ~)# NOP ^%PV F" - 0"c ;=4 ‰ d ‰ D# 760 ; V ~)# :5 2Q ˆnumber‡ 760 6 (W6$
Oc < D# 2] J 760 ;=4 :5 760

RLD €1! 2 F

Z 9"$

Example 1

L MD2
Load value into ACCU1
RLD 4
Rotate bits in ACCU 1 four places to the left
T MD8
Transfer result to MD8

Example 2

L +3
Load value +3 into ACCU1
L MD20
Load contents of ACCU1 into ACCU2. Load value of MD20 into ACCU1
RLD
Rotation number is value of ACCU2-L-L => Rotate bits in ACCU1
three places to the left
JP NEXT
Jump to NEXT jump label if the bit rotated out last (CC1) = 1
Rotate Right Double Word (32-Bit) : RRD

"$ RRD 0"c 2 DE 760 D# " % & , -. % ACCU1 ! " 0 # . 0"c EQ !<
2 CC1 " ACCU2-L-L ! D# " % & , -. 0 # 7 4 ,0L " 0"c ( $ ~)
7 2 % <. 3 % JK 0L 7 2 % `F" 7 # J ) 7 % & 0&T 6 ( D!
% J )

r 84 :5 760 ; V ~)# NOP ^%$ ( F" - 0"c ;=4 0LO RRD 0"X -. 760 ; V ~) † $
ACCU1 ! " 6 24 0 K

ACCU1 ( RRD 0 YP €1! k! 2 F

Z 9"$

Example 1

L MD2
Load value into ACCU1
RRD 4
Rotate bits in ACCU1 four places to the right
T MD8
Transfer result to MD8

Example 2

L +3
Load value +3 into ACCU1
L MD20
Load contents of ACCU1 into ACCU2. Load value of MD20 into ACCU1
RRD
Rotation number is value of ACCU2-L-L => Rotate bits in ACCU1 three places
to the right
JP NEXT
Jump to NEXT jump label if the bit rotated out last (CC1) = 1
Rotate ACCU 1 Left via CC 1 (32-Bit) : RLDA

CC0,OV " FV 0 LW # 3 ()M # % & CC1 " ACCU1 ! " 0 # . 0"c EQ !<

EL F N €1! 2 F

Z 3 9"

L MD2
Load value of MD2 into ACCU1
RLDA
Rotate bits in ACCU1 one place to the left via CC1
JP NEXT
Jump to NEXT jump label if the bit rotated out last (CC1) = 1

Rotate ACCU 1 Right via CC 1 (32-Bit) : RRDA

CC0 , OV 0 LW " M # %& % CC1 " ACCU1 ! " 0 # . 0"c EQ !<

CC1 # ACCU1 ! " ( 0"c 0 YP h 2 F

Z 3 9"

L MD2
Load value of MD2 into ACCU1
RRDA
Rotate bits in ACCU1 one place to the right via CC1
JP NEXT
Jump to NEXT jump label if the bit rotated out last (CC 1) = 1
/0
V 0VE . b&$# % W 24 M,!S!" V 2-6 # _~! % !Q %)# 21 0 4 3 9" l H hp
Y " O D$ #$ ` .0JV 8. V #$ {8 $ O J. 2

Z2 F E&P V # <. W " F. V m M # F9 10 L V

Z2 F . F. V J M0 h. J 7 V jEQ ;$ q
M1-M2-M3-M4-M5 V0 " & 4 3#c F " €1 # !Q V#

Z 2 n V JL] \#

0 0 K" G m ', H 0I ^47 7 # m # "x M0 h {0 DE # 2 ]0 '! ! Z M1


^ " E&R # .! p 0 M' N)# FOR/REV j X M' N)# JOG M' N)# Run M' N) ^ K U f
m ' " -L 0 M' N)# '! ! 2 ]0 I < # Drive fault 0h- ' N) 7
2 T #$ D# ;! ;$ FK
m ' JOG H 0I ~ ;! # m #$ "x ;! D# F K
3 ') /! p •<4 %)# f m ' . ~ F L z0- % # G H 0I ;! 2 n F K
•<4 /! p 0h- M' N)

7 # M0 h ( F. }' 7 3 #$ F" . F" 0 . } & !Q# Z M2


RUN V " T #$ JOG # F K # Limit switches S1,S2 H 0I j X l
M0 h '! !" ( Hhp " ^ Hhp # m ', H 0I † $ '! ! EQ F K 7 #

i '~ FV 4' #3 # ; 'E 4' H 0I M0 h 3#U%# 40 ; " # Z M3,M4


0&n # ( c # Limit switch ' ! " J% | L" 5 , ^ i '~ FV ;$ ƒ 8" " M (
Overload " 3#U 0&n # 40 Q $ '! V %!V 5 , '! !" F E # FL c

5 .7 - jEQ# M0 h F U # V0 % " 'E f H u G 0< # € L # Z M5


Overload "HK ## € L # '! V %!V

( c ; 'E ;! # S6 ; < K" ; 'E ;! ;$ 42TF . V F - 2 ^%$ ƒ 8" #


-"
S3,S7Š

Z n € L D! FK € L" !

Emergency stop - Stop - Start - Jog forward - Jog reverse - Traverse right
Traverse left - Traverse reverse direction - Fault reset

Z n ; h h ( D! #

Emergency stop - Machine fault - Machine ready - Machine run - Traverse right
Traverse left
1 2( " 3 4

EQ ;=4 <hI# ƒ S0 # 8& 0W 2Q 7 W 24 ( #c 0 #$ M!p


Z 2 n V 0W

Z Digital inputs 60 8&


Z V FK < 0I 24 ^ 0N Hh "# F K hp <4# 2 n F #

Z . O 8& Z X#$
Emergency stop button
Reset fault button
M1 drive fault
M2 drive fault
M3 Overload
M4 Overload
M5 Overload

Z Limit switches F K € L" Z % Y


Right arm up limit switch S3
Right arm down limit switch S4
Left arm up limit switch S7
Left arm down limit switch S8
Pintles open limit switch S5
Pintles close limit switch S6
Traverse right end limit switch S1
Traverse left end limit switch S2

Z Operating panel FK . O F K € L" Z 9 Y


Auto/Manual selector switch
Stop push button
Start push button
JOG forward reel push button
JOG reveres reel push button
Traverse manual to right
Traverse manual to left
Traverse toggle direction push button
Right arm up push button
Right arm down push button
Left arm up push button
Left arm down push button
Both arms up push button
Both arms down push button
Pintles open push button
Pintles close push button

/ a •5Œ 2I h . , - EQ " f B‹5Œ G "U ^%=4 F& " :5 !Q# , - EQ ( ` .#


ƒ ( $0p 6 L \# Dc _ X

Z2n F # Digital outputs 60 S0

Z0 ! FK ' N) Z X#$
Main motor M1 Run
Main Motor M1 JOG forward
Main motor M1 JOG Reverse

Traverse motor M2 Run


Traverse motor M2 JOG to the right
Traverse motor M2 JOG to the left

Right arm motor M4 up


Right arm motor M4 down

Left arm motor M3 up


Left arm motor M4 down

Pintles motor M5 open


Pintles motor M5 close

Z Indication lamps ; h h Z %Y
Fault lamp
Ready lamp
Run lamp
Traverse to right lamp
Traverse to left lamp

"#, { Q ;! q . :5 F†4$ %$# :5 #$ 5A !Q EJ , /06$ ;=4 2 .# By S0 jEQ , #


h< " 8 - Dc 24 V 2I
Z Analogue inputs 0\ 8& ~ -.#

Z2n F 2Q#

Tension set value to reel drive


Traverse step to traverse drive
Actual speed reel motor

Z Analogue outputs 0\ S0

Z2n F #

Reference signal to reel drive for current set


Reference signal to traverse drive speed

Analogue 0\ S0 " A , # Analogue inputs 0\ 8& " A , "U k! 2 .#


outputs

"!ƒ . O %! " S X. "V ]6 ;n 2 .#

7 W 24 ( #c 0 a EJ.#
1 2( #$ 4

Z -4 " 8 %! 2Q % 9 0

Z 2 n <. hƒ U k! #

Rail : 6ES7390-1AB60-0AA0
Power supply PS 307 10A : 6ES7307-1KA00-0AA0
CPU 314 : 6ES7314-1AE01-0AB0
Digital input module SM321 ( 32DI x 24 VDC ) : 6ES7321-1BL00-0AA0
Digital input module SM321 ( 32DI x 24 VDC ) : 6ES7321-1BL00-0AA0
Digital output module SM322 ( 32DO x 24 VDC 0.5 A ) : 6ES7322-1BL00-0AA0
Analogue input module 8 channel SM331 ( AI 8x13 bit ) : 6ES7331-1KF00-0AB0
Analogue output module 4 channel SM332 ( AO 4x12 bit ) : 6ES7332-5HD00-0AB0

Simatic manager . ƒ ` . 0" ~ -. 2 P 7Y

2 F 24 V Project i#0 ` %=. !<%


Z2 F . ;! k! # <. 0N V ƒ %! " 3 &,=. !<% 7Y

Z 2 n V Digital inputs # ;$ Ž 8%#

I 0.0 ... I 0.7


I 1.0 ... I 1.7
I 2.0 ... I 2.7
I 3.0 ... I 3.7
I 4.0 ... I 4.7
I 5.0 ... I 5.7
I 6.0 ... I 6.7
I 7.0 ... I 7.7

Z 2 n V Digital outputs # #

Q 8.0 ... Q 8.7


Q 9.0 ... Q 9.7
Q 10.0 ... Q 10.7
Q 11.0 ... Q 11.7

Z 2 n V Analogue inputs # ;! #

PIW 304
PIW 306
PIW 308
PIW 310
PIW 312
PIW 314
PIW 316
PIW 318

Z 2 n V Analogue outputs # ;! #

PQW 320
PQW 322
PQW 324
PQW 326
89" -L !"0 " 2S' F O! 2Q M!p

I 0.0 --> EMERGENCY STOP


I 0.1 --> M1 DRIVE FAULT
I 0.2 --> M2 DRIVE FAULT
I 0.3 --> M3 OVERLAOD
I 0.4 --> M4 OVERLOAD
I 0.5 --> M5 OVERLOAD

I 1.0 --> LIMIT SWITCH S1


I 1.1 --> LIMIT SWITCH S2
I 1.2 --> LIMIT SWITCH S3
I 1.3 --> LIMIT SWITCH S4
I 1.4 --> LIMIT SWITCH S5
I 1.5 --> LIMIT SWITCH S6
I 1.6 --> LIMIT SWITCH S7
I 1.7 --> LIMIT SWITCH S8

I 2.0 --> FAULT RESET P.B


I 2.1 --> MAN/AUTO SELECTOR SWITCH
I 2.2 --> STOP P.B
I 2.3 --> START P.B
I 2.4 --> JOG FORWARD P.B
I 2.5 --> JOG REVERSE P.B
I 2.6 --> MANUAL TRAVERSE RIGHT P.B
I 2.7 --> MANUAL TRAVERSE LEFT P.B

I 3.0 --> TRAVERSE DIRECTION TOGGLE P.B


I 3.1 --> RIGHT ARM UP P.B
I 3.2 --> RIGHT ARM DOWN P.B
I 3.3 --> LEFT ARM UP P.B
I 3.4 --> LEFT ARM DOWN P.B
I 3.5 --> BOTH ARMS UP P.B
I 3.6 --> BOTH ARMS DOWN P.B

I 4.0 --> PINTLES OPEN P.B


I 4.1 --> PINTLES CLOSE P.B

Q 8.0 --> MACHINE FAULT LAMP


Q 8.2 --> MACHINE READY LAMP
Q 8.1 --> MACHINE RUN LAMP
Q 8.3 --> TRAVERSE DIRECTION TO RIGHT
Q 8.4 --> TRAVERSE DIRECTION TO LEFT

Q 9.0 --> MAIN MOTOR M1 RUN AUTO


Q 9.1 --> MAIN MOTOR M1 JOG FORWARD
Q 9.2 --> MAIN MOTOR M1 JOG REVERSE
Q 9.3 --> TRAVERSE RUN AUTO
Q 9.4 --> TRAVERSE MOTOR M2 TO RIGHT MANUAL
Q 9.5 --> TRAVERSE MOTOR M2 TO LEFT MANUAL

Q 10.0 --> RIGHT ARM MOTOR M3 UP


Q 10.1 --> RIGHT ARM MOTOR M3 DOWN
Q 10.2 --> LEFT ARM MOTOR M4 UP
Q 10.3 --> LEFT ARM MOTOR M4 DOWN
Q10.4 --> PINTLES MOTOR M5 OPEN
Q10.5 --> PINTLES MOTOR M5 CLOSE

PIW 304 --> REEL TENSION SET VALUE POTENTIOMETER


PIW 306 --> ACTUAL REEL SPEED FROM DRIVE A/O
PIW 308 --> TRAVERSE SET POTENTIOMETER

PQW 320 --> MAIN MOTOR DRIVE SET VALUE


PQW 322 --> TRAVERSE MOTOR DRIVE SET VALUE

V 2& t" %0h F 26 . •<4 ;! E Q#


F Symbol table 3 &,=. !<% t" %0h 3 !I -" S0 # 8& !"' ;! ( #
Z2
s#0 ;$ 0h -% k! q 3 p c h6 0 JWW % k! 2 # Function --> FC1 3#c 3 9" EQ
Fault Fp { Q ;! X ( Q04 ! S # n
E-stop _ L" e
M1 M0 h m ', e
M2 }' M # m ', e
M3,M4,M5 ] U F e

Reset F 7 ( Fp- 3 # 24 ( J . ŽL # Fault h w† Pp& r# 24#


Fault Reset P.B E. } | L H 0I

;! EV# M1.0 = 1 Fp ,!S# 24 Machine ready 2 n F K MUQ S V ;! e


; < K" ; 'E ;! # ( $ ( ) ; 'E 8V

Z2 F 24 FC1 ! "F N
Z2n F #FK F #$ M0 h U J 2Q -
3 # 'E 3#U%# 4' e
3#U Q0 0 # F M0 h ; 'E H u# € 4 e
Z n s#0 . 7 - jEQ
f M 1.0 G Fp D$ { Q ;! X ;$ .X e
Q $ •<4 3#U # 40 89" a6! lL% 24 ; . < " ; 7 Xe
fFK 24 a G L6! " V ;! ;$ .X e
E , Limit switch " V0 2J e
M0 h < X ( FL c ; 'E 1# 24 ( ) 7 X € L e
S1,S2 -. F" ;! ;$ .X D$ } O0 ,# ( F" ;$ I 7 X H K # € L e

- . < FC2 ` %) 7

H40 F H K # € L # 3#U # 40 E&P 2 .#


M1 M0 h '! !" !Q# 2 ]0 '! ! ( '# ` S ;n #

F K ;! Manual 1! . F K q Auto/Manual ' &X FK " ; !% ^ #


•<4 U # m ' i !%$ FV 24 ,!S!" EQ# JOG 1! 24 m ' H 0I Q 7 .Y 0 .
Jog reverse #$ Jog forward F K i!% Digital M' N) _#0&

FV 24 k#0-" ƒ% !Q# f H 0I '! ! 0 24 7 ;! G 2 n F K !Q 2% 9 i!


!Q f Analogue " F" - p . .# . - ' h &X G ^. !< " FV# m ' i !%$
_ 0& ~ -.# (W6c F" -" 24 /0† # M` 0<

;! ;$ .X 2 n F K # 3 p c " & V ;! ;$ .X Auto/Manual 8V 24


; < K"# ( c ; 'E

Z ~ E L 3 9" €1! n 3 Nc
2n FK 7Y m # "x # M0 h F K X#$

|! (W6c 24 7 Scaling F # . O M0 K "# < " M` 06 % Y


2n FK 0LO ;! # 2 n F K •<4 6 _#0& ~ -.

<hI 7Y M'# " < F N 24 7ƒ " F . M0 h ( F. #$ }' M # '#, ` S ;n #


3 ( )# ( ) ^ V F" {0 DE # M2 '! ! H 0I 1#$# Hh V EQ 7 # "
FK M0 h 0 " " U . '! ! EQ 0 •h1 7 # . Y F. '#0" '! " Fƒ q .
.! p M!p ' < . } O0 {0 ;$ M0 h '#, " L F I . F . 0"c q 2 n
t F. <hI

DE # 0 •h1 F" -"# f , L G M0 h 0 Q 0 K " 24 68 } O0 0 4 2 .#


wN EQ# p& 0 !Q ! . YX /01 FO # f 7" G !Q# F. 0p6 F9 k!
J 24 ^ 4 1) 7 2 6' F" -" H 0I p . •h1 •<4 (<h # 2- hI# 2<p "

M0 h 0 ( ) i!S0 ;#, 0N h" F . ~ 7 4 D# FK "$

jE L |06 2 4#
EQ 7 # QE L 7 4 X)# QE L 7 ( OB1 24 J . V 7 2 0" #c jEQ FV 2 % ;$ 2<.
f I h jEJ. J . 24 '!"c ;! ;$ '$# G 2 F ( 24 ` X

<40" t" %0h " %# E L UQ S €hO$ t" %0h 4 EJ.#

Q •K1 F
' & 7Y M'!W 24 €1! ' &X H 0I Simatic manager H 0I t" %0h 47
m
% *(5 6 3 78 9 :'

< OB1 ;/ ' 3 78

M,!S! #$ 0N h" F . M,!S! ` ! D'#, F . OB1 24 M,!S! - E L . CPU !< e


2 1F .

M0N h" „0&$ M'#, ` . 7 OB1 M'#, E L " ` J %X ,0 . e

Startup i!% ; V $ CPU M ! Startup " ` J %X ,0 . OB1 M'#, 3#$ $ h e

L \! 3 # " L i !%c ` e
OB1 F& , function blocks FBs, SFBs or functions FCs, SFCs

OB90 "EL ! #$ OB F6$ !Q OB1 e

OB1 ` J47 2 X 2Q jEQ# e

The startup is completed•

The execution of OB1 (the previous cycle) has finished•

8& M` 06# S0 ( ) S0 Process image 3 ') 7 OB1 E L ` J % -.


CPU M # 24 " Global 0 K " D$#

Z M'!W 24 1! # Local variables }!W . "$


24 ~ Fh6 ( #c ! ;$ q M0 &c -.'c 2Q 1!" ;! ;$ 2 # J 4 7Qc #
F < 0I F9 2% 9 # •<4 {! h Identifier F9 3#c 4 "0h 24 " D$ J l K
S', F9 !Q# q 9 # bits F N ( !Q# OB1 E L ` . 7 ( ~ U # CPU M ! startup
F9 2 # M0 &c -.'c 0p c „! ~ -. S! X# B !Q# {! h 76' F9 2 # {! h ! #$
Z 0 .

f € O 76' M'!O 24 G QE L 7 M'#, 0&T " e

f € O 76' M'!O 24 G ^ 7 M'#, " F6$ e

f € O 76' M'!O 24 G ^ 7 M'#, " 0hV$ e

• ' # a6# M'!O 24 OB1 E L ` . a6## • ' e

< > 8 ? Data block = , 8( # ; !*

( -" ~ J V# Bytes A #$ Words 5 #$ bit :5 !Q Data block %! " " F" - (W6c 7
f < 40- G F 9 24 < 0I M'# . 24 1#$# Hh V 0 K i !%$ " i!% F # #

E Q# Time m Real m BCD m Integer F 9 < 0p4

Bit , Word , DoubleWord ! " ( F" - % %=4 Data block " F" - #
Data block 10 Z 89"

DB10.DBX2.0 Z 2 n V ;! Bit

E Q# d 76' % 5 76' Word Data block 10 j -" EQ

DB10.DBW2 Z 2 n V ;! Word V #

5 76' Word Data block 10 j -" EQ#

DB10.DBD2 Z 2 n V ;! Double Word #

5 76' Double Word L † Data block 10 j -" EQ#

" k0- %$ I Double Word # Word . t" %0h 24 F& 24 "{ Ql #


" 8WL " m 0- ;! ;$ ~) ^] %) Data block m 0- 24 ! X F& EQ #
Double D$ L †" 76, C # 5 " FV ;$ 0 ( Data block F& , a40 ~) 89"#
i! " p # M0V ~ ( ) J <% 7 ~( K # FWL " F . Word 4 ! 84 word
MW J " `US ~ -. 7Y MD

t" %0h F& , 3 - X 24 ] J% " D$ S! 84 M , MB , MW , MD M0V E 8& "$

Lower ;$ ƒ 8" " " € O EJ4 MW0+MW1 " ;! MD0 ;$ }!W . ^ 0V~ " EV
MW0 l # MW1 ;! word

Load/Transfer 0" #c H 0I ;! E4 Data block F& , J U # % h M` 06 "$


FBD #$ LAD 24 Move #$ STL 24

Word , Double „! " ( EQ M'# 38& Load/Transfer / . 24 F WL . EQ |0N 7 6#


word

Binary Logic operations FV J Hhp 4 bit "$

DE 3# " 89 4 data block F& , double word #$ word 76' F9 3# 24 address ,! -


DB_VAR ^ DE 0 K J L% 2Q DB1.DBW0 ;! ^ <4'$

0K <. 24 E Q# moh 0 K F9 2J4 DB1.DBW2 "$


Accumulator-1-L F& , moh 0 K 6 F . !< %=4 L DB1.DBW2 0"c a" !4
Comments ;# . CPU ( " Upload F -. a 6 ~) •<4 !"' X) 2Q 4 J h V 2 0K "$
!"0 jEQ 4 S i#0 " ( #$

data block 24 Double Word #$ Word 76' !J4 <h " 0V~ V Address M ] 4#

lL% ( ) < F<%# % Y 6 F 7Y Accumulator-1 24 6 F 2% 9 H }!W . "$


J . l # ; " ; 0"c ; V ~) # Data word " < < ( k! hph 4 data word
" J,- # Accumulator-2 24 %U " ;! < < ;=4 „0&$ % . D$ F
Accumulator-2
0 u t" %0h 24 ` p&$ r X ( J 2 % h K O 2 0 ;$ .X <h " 0V~ V 2&$ EV
2 n V Double Word 6 m †" € O 76' F m Word € O 76' F 4 M,!W<"
Z
L 100
T DB1.DBW2
L L#500
T DB1.DBD4

4 L †" 6, „0&c # , 6, M # ; V 5 89" ; ! - lL % X <h " 0V~ V EV


Z 2 n 3 - Pp
L 100
T DB1.DBW2
L L#500
T DB1.DBD2

" " •<4 # i! Address 3 - %)# Pp& EQ# 5 ; ! - m 0- S #, 2 - EJ4


DE % h 7 ( ` . T j ! 7 Address ;=4 €1 # !Q V# 3# 24 0V~ V# U
Type % & 24 j,
3 &,) Q # ( #c < <L ;$ 2- hp 4; lL% 24 " 6 ;U ;$ ,'$ ~) "$
Z 89" ( #c < _ 24 • # ; "
L 100
T DB1.DBW2
L DB1.DBW2
T DB1.DBW4
L 200
T DB1.DBW2

DB1.DBW4 24 ] , M,!S!" < < J4


L IB20 3
24 ^ 6' DE 3! ,! " 8-4 5d 76' Input byte " 8& M` 0<. !< !J4 L IB20 0"c
Hardware configuration address=20

7 ^%=4 d@ D$ Q,!S# 24 J V % Y Q, F K s#0N " ! " ^%$ z0 L% 89 4


M 10.0 ; ! - lL Reset F 7 J " D$ ,!S# 24# M 10.0 ; ! - Set F

AND , OR 0"c " X h4

O I 20.0
O I 20.1
O I 20.2
O I 20.3
O I 20.4
O I 20.5
O I 20.6
O I 20.7
R M 10.0

AN I 20.0
AN I 20.1
AN I 20.2
AN I 20.3
AN I 20.4
AN I 20.5
AN I 20.6
AN I 20.7
S M 10.0

Z 0"c
L IB 20
L0
@@I
S M 10.0

L IB 20
L0
ˆ‡I
R M 10.0
L STW 3

89" 2Q FQ # CPU F& , h6 0" 7 ^ D$ F -. ^%=4 L STW 0"c "$


, 2 # % h jEQ ‘ E Q# . 24 OVERFLOW { Q FQ #$ 0LO #$ 0LW " 0hV$
s#0 V EV J" jEQ# Status word ; .( 4 J U 7 0&T %
Accumulator 1 F& , J H 0I ~ # - t] % ( ` . m] \! …-.
24 ~ †%# h 0< - S " Status word 0 K ( ) 0 % %$ U U- 2&$ ] , Ž X#
- . <40" 3# S

RND 3

()0 0< . F V € O 76' ( ) D0 - 760 F ! . ~# 0< -. !< ^%=4 RND 0"c


/06c € W 760

k† € O # ( ) ^.0< 7 mW " 0hV$ 0 ; V ;)# ^4E 7 mW " F6$ 0 ; V ;=4


Oc W <

Bd ( ) 0< 7 Bd‹Œ Z 89" 2S# € O 76' /06c 0< 7 mW% D$ " d‹Œ 0 ; V ;)#
E Q# B5 ( ) ^h 0< 7 4 BB‹Œ "$

" 0 kE H 0I ~# € O 76' ( ) D0 - 760 F ! . † $ !< 4 TRUNC 0"c "$


Bd €hW Bd‹’ 89" ^ 6 a% V J"

( ) ^ 6 a% V J" 0 0< H 0I € O 76' ( ) D0 - 760 F ! . !< 4 gRND 0"c "$


eBB €hW eBB‹5 EV# BB €hW Bd‹5 89" S!" € O 76' 0hV$

( ) ^ 6 a% V J" 0 0< H 0I € O 76' ( ) D0 - 760 F ! . !< 4 eRND 0"c "$


eB5 €hW eBB‹5 # Bd €hW Bd‹y 89" S!" € O 76' 0KO$

L PIW 3 @ L IW 3

F< . !< # Digital input module 2 6' 3! ,!" " Digital input word F . !< L IW 0"c
Accumulator-1 24 <

Accumulator-1 F& , integer F N 24 Analogue input word F . !< 4 L PIW 0"c "$

24 0"c -. Address ƒ 8" "

multiple jump 3
# ACCU1-L-L 24 ' 0< ~ 7 J ` .2 < F 7 ^%=4 multiple jump 0"c
5ŒC J (W6c # Word a # Byte 2J4 S ~ ƒ 8"

~, DE !Q 0"c 0p $ , ;$ q k0W LV, 0"c . V < 0I ;=4 EV

" 0hV$ ; V ~) G ^ ) F< k! DE ; label U"0 . !h " JL ( D! DE # 3#c 0p 4


f JU 0p $ " 0 &c 0p

ACCU1-L-L ! " 24 ^% " ( ) 3 < %X , 0 U"0 . !h " JU ( D! 2 0p


0LO
ACCU1-L-L ! " 24 ^% " ( ) 3 < %X , 0 U"0 . !h " JU ( D! 2 0p
B D#
ACCU1-L-L ! " 24 ^% " ( ) 3 < %X , 0 U"0 . !h " JU ( D! 2 0p
5 D#
E Q#

l # •<4 t" %0h 24 V "c !"' ,0 " 2J4 LSTX , SEG0 , SEG1 , COMM , SEG3 !"0
0&T wN D$ ( 3! " D$ J

Status word

M " J# JV7 2 - h6 0 CPU F& , 2J4 J ) 0N$ 2 Status word


Z 2 F V % & ’ •<4 J " 0N$ V 2Q# t" 0h F& ,

Z 2Q# J % _ 0& J" t"0h X# t" %0h E L ` Y$ 0 K X % & { Q ;$ q


FC , STA , Or

0 K EQ# 0"c EQ ( h 0 # 0"c i! <hI 0 K 2J4 % <. "$


J z0- % 2 0" #c " 0"$ FV " Q0V~ 7 0 K 2 % #

7 <p " 0&T % U 7 q Result of Logic Operation 3 ' W & 2Q# RLO 89"
E Q# AND,OR,NOT,XOR 4#0- <p - " D$ " J 4 QE L

" 89 4 Overflow " U < 0I ,# # . ; O & Q# OS , OV ; %


6' 0†. 89" a 6 ~=4 :5yC? !Q M' N) #~ 76' 0hV$ W 6'c 24 ^%$ k#0-
% 0 K # Overflow r 2 .# 760 ,# " 0hV$ ;=4 Bddd> Bddd
OS,OV

h. ' 0< , # 89" 6' . %' < ; " J4 CC 0 , CC1 ; % "$


^" ;$ a%$ p † $ # t" %0h F& , ] < ~ 7 # % Q ( -
% jEQ 0 K L V %' < 24 k! # ^ 4 . #$ ^ " M` 0< . ` ! Fh6 " 0N V

7 q Binary Result ] 9 - h6 0 † $ 4 J " €1 # !Q V# BR % "$


] 9 - t] % U J4

AB ,CD 9 :'

( 3 Status register ( CPU M0V E. 6!" 24 J U 7 bits " , 2Q Status word


% & BC 3 " •<4 " " % & ’ , J "# QE L 7 0&T %

7 <p " 0&n <hI J 6 0 K q Result of Logic Operation Q -"# RLO % & J "
RLO 6 ;! ‰ d ‰ a% V ~)# ‰B ‰ # " RLO 6 ;! ‰ B‰ a% V ~=4 QE L
‰d‰ # "

( DE U ; " ! " ;$ D$ Overflow 2 - 2Q# OS , OV %&{ Q EV


^. |! # 6 Accumulator

0" #$ " 0"$ FV " Q0VE. !<% 0 K jEQ FV# t] <hI 0 K „0&$ % & † $ J 4#
"0h

Jump )
"F " F . jE L 7 DE # t" %0h 2- hp F p6 !Q J V Jump 0" #$ " 2 ]0 k J
'0 - M'# 24 ^ 1! 7 DE 0 u 0&T F . € 1! Q 3# $ k! # ^ DE 7Y 0p 3#$
8 lL%
t" %0h 24 , " 0&T ; " ( ) 3 < %X # t" %0h 2- hp F p6 !Q 6 V k J 4

;#, 3 < %X H< q s#0 " 0 u #$ -" s0N H< ( 2 h" ^%$ D$ I#0 " 3 < %X EQ ;! 6#
s#0N Dc 0ƒ
Z 0"c . ph 0" M0 9V ` N$ " .84 Q 2 .#

-.'$ " ;! DE # Label !Q U"' H 0I j 7 # ^ ) 3 < %X 7 DE ; !Q# J #$


a001 F9" k0 J #$ ;! ;$ s0 . 6'$ #$ k#0

0"c 4 E L 0"$ 7 ;=4 E L 0"$ 0p lL . ;! ;$ .X 7Y Za001 F . #


Z 2 0p F9" NOP 0

a001: NOP 0

( - X DE # s#0 0 u 3 < %X !Q# JU 0"c { J4 s0 i!% !J4 2% 9 0"c "$


Z2nV # s0N D$

JU a001

( ' 0< ~ 24 - DE # JC-Jump conditional - 0"c J #$# I#0 0" #c { Q#


E L 7 B 2Q 0"c Fh6 <p " 0&T % a% V# s0 H< ;=4 RLO 24 %U
Z 89" 3 < %X H< X 0LO a% V# s0 H< 7 ;)# 3 < %X

AN I 0.1
JC a001
JU a002
a001: L 100
T PQW 220
JU a003
a002: L 500
T PQW 220
JU a003
a003: NOP 0
BE
3 < %X #$ JZ 0LO a% V ;) 3 < %X F9" RLO 0 u „0&$ s#0N ( - „0&$ i !%$ { Q#
( - " Q0 u# JN h a% V ! #$ JP hS!" a% V ! #$ JNZ 0LO 7 ;)
“' 24 F O L ( ) i!S0 # CC0,CC1,BR 2Q# Status word 24 „0&c %
J V 0" #c .}

7 q Q0 u# C K V - K 24 , - 3 < %X F9" " !Q# , - 3 < %X { Q 0 &$#


7 Q # <. € 1! 7 V 0 . Labels ( ) 3 < %X 7 < ( ` .# Byte F& , 6
F WL . 3 < %X X # F" . labels # 8h< " X

L DBW25 3

; F& , f DBW25 Q !Q# G J DE ; ! - ! "F . ƒ !< ;$ j -" Q L k0


ACCUMULATOR-1

|! L % h {! . " Word K O 24 5Π76' ; ! - Q -" DBW25 #

SRW 1 3

; 6 2J4 SRW 1 0"c

;$ 2 - B 760 # ( ) ACCUMULATOR-1 ! " =. 76 j - 4 SRW 3#c


^-1!" 24 EQ FV € 1! 7 6# M # % & ' < .

BOOL

•<4 6' " ;! DE # 6'x 2] 9 ƒ J. W< # Boolean ' W & 2Q BOOL V


Boolean algebra 2] 9 0h . M'!J # ] 9 - 7 J #B#d Q

Q0 u# AND-OR-NOT-XOR J "#

F9" TRUE or FALSE ") M # 6F " !Q Q % '!VE # BOOL i! "0K #


J 0 M •<

J BOOL i! ] < 7 ^%=4 bit " -4 EJ •<4 bits „! " ( ;! !Q#


AW 3

Z !Q# ^ 0V~ DE 3 9 F9" WORD " DE # AW 0"c

L MW20
L MW22
AW
T MW8

0" #c " ! "F "F EQ # D, - And 0"c ^. !< " ^ L% !Q 0"c EQ ^. !< " ;=4
Z2nV
Z 2 n V 1! ;! 4, - And 0"c . <. -.'c '!p D ! " . V %,'$ !

A M20.0
A M22.0
@M 8.0
A M20.1
A M22.1
@M 8.1
A M20.2
A M22.2
@M 8.2
A M20.3
A M22.3
@M 8.3
A M20.4
A M22.4
@M 8.4
A M20.5
A M22.5
@M 8.5
A M20.6
A M22.6
@M 8.6
A M20.7
A M22.7
@M 8.7
A M21.0
A M23.0
@M 9.0
A M21.1
A M23.1
@M 9.1

A M21.7
A M23.7
@M 9.7

M, - And " X . AW 7 4 H. 39 F9" -. " Addresses 3 - -4

! " { Q ; V ~) 89" <h " 4#0- s#0 " ! Mask F J" EV


q . # Input module ( J O! -" F K € L" #$ . ph 0 s#0 "
J 6 ;$ D$ BdBBddBBdBBBddBB‚5 89" € W F K J 7 # -. " ;!
H< ~# XOR #$ And ` ! Word 0" #$ " 0"$ D$ 7 # H. 760 F9" 2] 9 ƒ .
s0 "

Accum-1 F& , j -. 2 < F<% 7 Load 0"$ 3#$ ;=4 Accumulator1,2 ! " }!W . "$
F& , M < F . !< # Accum-2 ( ) Accum-1 ! " F< 2 Load 0"c #
jEQ 24 Fƒ # Accum-1 F& , ^ U 7 4 AW F9" M0 &c - t % "$# Accum-1
0 K ;#, Accum-2 ! "

24 0 K ;$ ;#, 0"c -. ; ! - F& , Accum-1 ! " U . !< 4 Transfer-T 0"c "$


Accum-2 #$ Accum-1 " D$ ! "

FR 3

;$ ~) 0 D, - F - D'#01 0 u !Q# ^ 2 a6R Enable F - FR 0"c


0 1 Enable F -. † $ !< SE,SD,SS,SF,SP F9" 0 ` h. O 0" #c
0 ;$ ( - . F-L . ^ K ` Y$ 0 0 K 24 hu0 ;! 0"c EJ 2 c X
0 K ;#, FR 0"c H 0I ~F 4 h " ^ K M, ) 0 a%$# F K 24 ;!
0 ` h. ph 0 F K s#0N 24

0 i!% h p<% ( ) 0 # h ( ) a6! , - ;$ €1#$ F . ( - #


Time base
; V ` ! ‚S5T % h K O 24 a6! 6 " a6! U"' 3 - ;=4 Time base }!W . "$
0h- # h #$ < 6 0h- # m #$ % 9 0h- # s #$ % Y 2 " 0h- # ms

M'!W 24 ^-† 760 24 j . !< " a%$ , # € O 76' F . !< %$ W< a V ! "$
q BCD F N E&P 2 # a6! . O Word F& , ; h F N ! 40-" "U J4 h
^ 4' ( ) . 0 760 . ’’’ ‘ ddd . |# 0 # a6! 6 F9 2 # 6'$ : " ;!
J 6 X# " " 0 u bit-14,bit-15 . bit-12,bit13 Q# a6! M 6 ;89 ; % &

Z2 ! ( bits-12,13 6 ( ` . a6! M 6 7 #

msBd ˆee dd
msBdd ˆee dB
sB ˆee Bd
sBd ˆee BB

. |# 0 2 # ( #c Y89 6'c 24 a6! 6 24 ms,100ms,1s,10sBd < /01 7 q


a6# F9 5Bdd ^ 6 DE # BCD . 2 760 89 4 .! p a6! 6 2p- ’’’# ddd
2 n V 2] 9 F . < ;! 4 ~ M 0" " .X O 6 F N 24 ^-1# # % Y Bdd ^ 6
Z
integer F N 24 J . V ?AA? < D ! " !Q# ddddeddddedddBedddB
E4F# G) ?

0 Bd 2 ! 0 ", 7 % %$ Ž 8% ;$ X#$

;$ 89" 4 , " ; V ;)# G S 0 9V ;! ;$ D$ , " 0 u ^%$ z#0L " , EV


f L " F K k#0\ Bd ^%$ D$ Bd ;!

0uFK . O „0&c % h 0 u ; . Bdd D$ Bd”Bd 2Q# \!L % h 42 .#


J L% t U % . 0 u# 0

F m] \# ( D! # F K % . ŽL # 3 &, # F 2Q h < 0p 4 jEQ 24#


3 - 7 # HMI N " N N D$ ;! # F K . O % h ` %)# F<%# kE # • %#
- jEQ FV ` 0S) " DE # N 24 ,!S! Recipe `U

Program control t" %0h ^ S! 3 N$ " M0 9V 3 NP. ~ 4 PLC F& , EJ. E L "$
" HI " Bd ( ) Data block 7 < 7Y Bd ( B " 6'$ ` p ) 4 instructions
6 ( ` . Jump €hW q . Structure F N 24 J #F lL% J
muliple #FK " 8 % h FV F . !< DE # t 76' ( 3 0W -
jump

L MB22 // MB22 contains product number to be used


JL Pr10 // Load Product 09 data
JU Pr01 // Load Product 00 data
JU Pr02 // Load Product 01 data
JU Pr03 // Load Product 02 data
JU Pr04 // Load Product 03 data
JU Pr05 // Load Product 04 data
JU Pr06 // Load Product 05 data
JU Pr07 // Load Product 06 data
JU Pr08 // Load Product 07 data
JU Pr09 // Load Product 09 data

Pr00 : L MW 0 // MW 0 contains time for product-1


SE T1
JU ENDS

Pr01 : L MW 2 // MW 2 contains time for product-2


SE T1
JU ENDS
Pr02 : L MW 4 // MW 6 contains time for product-3
SE T1
JU ENDS

Pr03 : L MW 6 // MW 6 contains time for product-4


SE T1
JU ENDS

Pr04 : L MW 8 // MW 8 contains time for product-5


SE T1
JU ENDS

ENDS : // Here you continue your program

H /I J *(+ ; ) K) L *(+M = ' ?54 N( ; G /'# O'


Local N( Global 8 N(

; G C K) J *(+ ;C Global 8 N( G) P 4 1+Q ; 9: ; RM ; S .


8 N( TUH I # U . / (5 U ' G C J G'C ( I #
Digital inputs,Digital outputs,Memory bits,Data blocks,Counters,Timers ,$
J W N K) Address G ' 8 V. I # ; G C K) J *(+ ;C N( TUJ
J( " / RX I # ; G C K)
Declaration ! ,A Function or Function block H 1( ( N( )
1( %#) K) Y ,A L *(5 KU A ) Z' ; N( TUJ " /)
; 3 V.# L *(+ 1( K) / (+ / [[[ACCUM1,ACCUM2,RLO 4 ; !*
1 G ( # 8(+ 1( ; J(#M / \# J ,A 1( ( 8
] A) J !*

( H / (+ / ? In FA J / ^ -) J \#) _ #
;C N( ` U O' J 54 1( ( Ia ( H Outputs O * 1R 8 J G'C(
5 J 8(+ 1( ( X N( b H \ ' V.# O * FA J *(+
Buffers +'

Binary bit F$ U. 4% / ( T c * K) G) ` C Return value )


g G'C d A b H G ' Return value 1 G'C f T ( L' \#) UH e d A b H ;C 1 '
UCH
+ H / ( # 6 Ch) ; ,Ch K) UAd N( TUH

"i ; # ( # TUH , 8(5

< JD #$ O 8 K UO j 54 # ) ' F$

y=ax^2+bx+c

< H 6'

y1=(-b+SQRT(b^2-4ac)/2a,y2=(-b-SQRT(b^2-4ac)/2a

) =:' " / UH 0 # k ;C

In FA a,b,c 1
Out O * y1,y2 1
temp Z' ; G'C ( ,A 5 J *(+ 1( U \ 'H

G ' "/ K) * ) 4 G ' , ?54 Return value ;C


.2 ; , ) G ' 4 ,4 'O' . l 8 G'C .2 K 5 ) ; )
UCH 4 ,4 'O L / 8 .- 8

; ; !* 0 J !* 1( 1 . ( ,2 4 %#n FC,FB ,A 1 m'2* )


1 ' "(4 ; c * . 1 , = ;C Data blocks ,$ J E.( KU Z'
Power ,2. . J # _ Global L 8 Z' ; \# _i Mi ( .
%&'

< H Blocks ; Z '#) RFR ; 4 ,A %( ( 1( I ; % (C# ,

Functions-FC, Function block-FB,Organization block OB

,Ch Kd J( ( ) K) " / K'( 'H ` X+ ' Z' ,$ Function 6 3 Z'


1R Insert a ; Blocks " i 6'A 8 Simatic manager ; %a D#n L' \#) T (*
Function 1R S7-Block

) 54 ) '+ J 8(+ ?o ) K) K'( K) " / K'( G) ;C


H o

Data block % 4 2 G) M A3 G) o Function block " / LFC V.# 0 `U

o ) h ,CD % p( 1 I # qh K) U . 1( F TU . 1( KU 'J OB )
OB r( ' 4) h

FC , FB % ' ;C V.# UAd % '( ;C


% /s

Interrupt #$ Subroutine #$ Function , Dc Call F •<4 PLC l # "! "0h 24


; "() % h F<% 7 2 .# ` X Fh6 memory area 24 a% V 2 % h <4 !Q
#$ E L -. J " 7 2 # , - 0 ! h 7ƒ% 24 Temporary files 24 7 " F9" L " ` ! "T
PLC „! " ( ~EL Buffer data block

Address #$ Accumulator . ` ! ^ L% t"0h ( - EJ4 E -" - "$


^ L% t"0h 0 4# t" %0h register

(W6$ V <. : " 09V$ t] . • L X 7 X ^%=4 - S |0N Hh " ^%$ q


U 4 2 .# •<4 <. M # • L X 7 2 t] 4 5 24 "$ Accumulator A ,!S# 24
k! VP . , ` % h ŽL Data block F9 Q 2 # Buffer area F t"0h
M,!S!" a% V 2 # Accumulators ! " % <L

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
] , 7V )# • <4#

hassanheha@yahoo.com

http://hassanheha.forumn.net

You might also like