Upload
ghitagabriel
View
222
Download
0
Embed Size (px)
Citation preview
8/10/2019 PRO2_02e
1/15
Date: 09.01.2015File: PRO2_02E.1
SIMATIC S7Siemens AG 2001. All rights reserved.
SITRAINTraining forAutomation and Drives
Accumulator Functions
8/10/2019 PRO2_02e
2/15
Date: 09.01.2015File: PRO2_02E.2
SIMATIC S7Siemens AG 2001. All rights reserved.
SITRAINTraining forAutomation and Drives
Overview of the Accumulator Functions
Instructions, that affect several Accumulators
TAK: Toggle (swap) the contents of ACCU1 and ACCU2
PUSH: Shifting the ACCU contents "upward"
POP: Shifting the ACCU contents "downward"
ENT: Shifting the ACCU contents "upward", without ACCU1
LEAVE: Shifting the ACCU contents "downward", without ACCU2
Arithmetic Instructions and Word Logic Instructions
Instructions, that only affect ACCU1
INC: Increment the contents of ACCU1-LL
DEC: Decrement the contents of ACCU1-LL
CAW: Reverse the order of the bytes in ACCU1-L
CAD: Reverse the order of the bytes in ACCU1
INVI, INVD: Forming the ones complement
NEGI, NEGD, NEGR: Forming the twos complement (Negation)
SLW, SLD, SRW, SRD, SSI, SSD: Shift the contents of ACCU1 word-by-word or doubleword-by-doubleword to the left or the right
RLD, RRD: Rotate the contents of ACCU1 to the left or to the right
RLDA, RRDA: Rotate the contents of ACCU1 to the left or to the rightvia the condition code bit CC1
8/10/2019 PRO2_02e
3/15
Date: 09.01.2015File: PRO2_02E.3
SIMATIC S7Siemens AG 2001. All rights reserved.
SITRAINTraining forAutomation and Drives
The Instruction TAK (Toggle ACCU1 and ACCU2)
S7-300:
S7-400:
ACCU1
ACCU2
V1
V2
V2
V1
before after
ACCU1
ACCU2
V1
V2
V3
V4
ACCU3
ACCU4
V2
V1
V3
V4
before after
TAK
TAK
8/10/2019 PRO2_02e
4/15
Date: 09.01.2015File: PRO2_02E.4
SIMATIC S7Siemens AG 2001. All rights reserved.
SITRAINTraining forAutomation and Drives
The Instructions PUSH and POP
S7-300:
ACCU1
ACCU2
V1
V2
V1
V1
before afterPUSH
S7-400:
ACCU1
ACCU2
ACCU3
ACCU4
V1
V2
V1
V2
V3
V4
V1
V1
V2
V3
before afterPUSH
V2
V2
before afterPOP
V1
V2
V3
V4
V2
V3
V4
V4
before afterPOP
8/10/2019 PRO2_02e
5/15
Date: 09.01.2015File: PRO2_02E.5
SIMATIC S7Siemens AG 2001. All rights reserved.
SITRAINTraining forAutomation and Drives
The Instructions ENT and LEAVE (only S7-400)
ENT:
LEAVE:
V1
V2
V3
V4
ACCU1
ACCU2
ACCU3
ACCU4
V1
V2
V2
V3
before after
V1
V2
V3
V4
ACCU1
ACCU2
ACCU3
ACCU4
V1
V3
V4
V4
before after
8/10/2019 PRO2_02e
6/15
Date: 09.01.2015File: PRO2_02E.6
SIMATIC S7Siemens AG 2001. All rights reserved.
SITRAINTraining forAutomation and Drives
Arithmetic Instructions
S7-300:
S7-400:
ACCU1
ACCU2
V1
V2
V2 op V1
V2
before after
ACCU1
ACCU2
V1
V2
V3
V4
ACCU3
ACCU4
V3
V4
V4
before after
op: +., -., *., /.
V2 op V1
op: +., -., *., /.
8/10/2019 PRO2_02e
7/15
Date: 09.01.2015File: PRO2_02E.7
SIMATIC S7Siemens AG 2001. All rights reserved.
SITRAINTraining forAutomation and Drives
Word Logic Instructions
S7-300:
S7-400:
ACCU1
ACCU2
V1
V2
V2 op V1
V2
before after
ACCU1
ACCU2
V1
V2
V3
V4
ACCU3
ACCU4
V2
V3
V4
before after
op: A.., O.., X..,
V2 op V1
op: A.., O.., X..,
8/10/2019 PRO2_02e
8/15
Date: 09.01.2015File: PRO2_02E.8
SIMATIC S7Siemens AG 2001. All rights reserved.
SITRAINTraining forAutomation and Drives
Change Instructions for ACCU1
CAW:
CAD:
V4 V3 V2 V1
ACCU1-HH ACCU1-HL ACCU1-LH ACCU1-LL
V4 V3 V1 V2
V4 V3 V2 V1
V1 V2 V3 V4
8/10/2019 PRO2_02e
9/15
Date: 09.01.2015File: PRO2_02E.9
SIMATIC S7Siemens AG 2001. All rights reserved.
SITRAINTraining forAutomation and Drives
Increment Instructions for ACCU1
ACCU1-HH ACCU1-HL ACCU1-LH ACCU1-LLINC :
V4 V3 V2 V1
V4 V3 V2 V1+
+
DEC :
V4 V3 V2 V1
V4 V3 V2 V1-
-
8/10/2019 PRO2_02e
10/15
Date: 09.01.2015File: PRO2_02E.10
SIMATIC S7Siemens AG 2001. All rights reserved.
SITRAINTraining forAutomation and Drives
Forming the Ones Complement
0 1 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 1 1 0 0 0 1 0 0 0 1 1 1
031
INVI (Ones Complement of ACCU1-L):
15 ACCU1-LACCU1-H
0 1 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 1 1 1 0 0 1 1 1 0 1 1 1 0 0 0
031 15
0 1 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 1 1 0 0 0 1 0 0 0 1 1 1
031
INVD (Ones Complement of ACCU1):
15 ACCU1-LACCU1-H
1 0 1 1 1 1 0 1 1 0 1 1 0 1 1 0 0 1 1 1 0 0 1 1 1 0 1 1 1 0 0 0031 15
8/10/2019 PRO2_02e
11/15
8/10/2019 PRO2_02e
12/15
8/10/2019 PRO2_02e
13/15
8/10/2019 PRO2_02e
14/15
Date: 09.01.2015File: PRO2_02E.14
SIMATIC S7Siemens AG 2001. All rights reserved.
SITRAINTraining forAutomation and Drives
2 3
Exercise 2.2 : Data Exchange in ACCU1
ACCU1 - L (before)10
CAW
ACCU1 - L (after)0 132
8/10/2019 PRO2_02e
15/15
Date: 09.01.2015File: PRO2_02E.15
SIMATIC S7Siemens AG 2001. All rights reserved.
SITRAINTraining forAutomation and Drives
Exercise 2.3 : Forming Complements
Bit 15 Bit 0
Forming the OnesComplement: INVI
1 . . . . . . . . . . . . 1 0 1
ACCU1-L (before)
Bit 15 Bit 0ACCU1-L (after)
0 . . . . . . . . . . . . 0 1 0