Swap Instruction - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents
Programming instructions
6.1 Basic instructions
FILL_BLK and UFILL_BLK instructions differ in how interrupts are handled:
● Interrupt events are queued and processed during FILL_BLK execution. Use the
● Interrupt events are queued but not processed until UFILL_BLK execution is complete.
ENO status
1
0
6.1.6.1

Swap instruction

Parameter
IN
OUT
Address
W#16#1234
WORD
Address
DW#16#
12345678
DWORD
122
FILL_BLK instruction when the data at the move destination address is not used within an
interrupt OB subprogram or, if used, the destination data does not have to be consistent.
Use the UFILL_BLK instruction when the move operation must be completed and the
destination data consistent, before the execution of an interrupt OB subprogram.
Condition
No error
The destination (OUT) range exceeds the
available memory area
You use the SWAP instruction to reverse the byte order for two-byte and
four-byte data elements. No change is made to the bit order within each
byte. ENO is always TRUE following execution of the SWAP instruction.
Click below the box name and select a data type from the drop menu.
Data type
Word, DWord
Word, DWord
Example: Parameter IN = MB0
Pre SWAP execution
MB0
MB1
12
34
MSB
LSB
MB0
MB1 MB2 MB3
12
34
MSB
Description
Ordered data bytes IN
Reverse ordered data bytes OUT
56
78
LSB
Result
The IN element was successfully copied
to all COUNT destinations
Elements that fit are copied. No partial
elements are copied.
Example: Parameter OUT = MB4,
Post SWAP execution
MB4 MB5
34
12
MSB
LSB
MB4 MB5 MB6 MB7
78
56
34
12
MSB
LSB
S7-1200 Programmable controller
System Manual, 11/2009, A5E02486680-02

Hide quick links:

Table of Contents
loading

This manual is also suitable for:

Simatic s7-1200

Table of Contents