Simatic S7 Opcodes (S7-300, S7-400) - 135 opcodes
Format: A <Bit>
A checks whether the state of the addressed bit is "1", and ANDs the test result with the RLO.
Format: N <Bit>
AN checks whether the state of the addressed bit is "0", and ANDs the test result with the RLO.
Format: O <Bit>
O checks whether the state of the addressed bit is "1", and ORs the test result with the RLO.
Format: ON <Bit>
ON checks whether the state of the addressed bit is "0", and ORs the test result with the RLO.
Format: X <Bit>
X checks whether the state of the addressed bit is "1", and XORs the test result with the RLO.
You can also use the Exclusive OR function several times. The mutual result of logic operation is
then "1" if an impair number of checked addresses is "1".
Format: XN <Bit>
XN checks whether the state of the addressed bit is "0", and XORs the test result with the RLO.
Format: O
The O function performs a logical OR instruction on AND functions according to the rule: AND
before OR.
A(: And with Nesting Open
Format: A(
A( (AND nesting open) saves the RLO and OR bits and a function code into the nesting stack. A
maximum of seven nesting stack entries are possible.
AN(: And Not with Nesting Open
Format: AN(
AN( (AND NOT nesting open) saves the RLO and OR bits and a function code into the nesting
stack. A maximum of seven nesting stack entries are possible.
Format: O(
O( (OR nesting open) saves the RLO and OR bits and a function code into the nesting stack. A
maximum of seven nesting stack entries are possible.
ON(: Or Not with Nesting Open
Format: ON(
ON( (OR NOT nesting open) saves the RLO and OR bits and a function code into the nesting
stack. A maximum of seven nesting stack entries is possible.
X(: Exclusive Or with Nesting Open
Format: X(
X( (XOR nesting open) saves the RLO and OR bits and a function code into the nesting stack. A
maximum of seven nesting stack entries is possible.
XN(: Exclusive Or Not with Nesting Open
Format: XN(
XN( (XOR NOT nesting open) saves the RLO and OR bits and a function code into the nesting
stack. A maximum of seven nesting stack entries is possible.
Format: <Bit>
= <Bit> writes the RLO into the addressed bit for a switched on master control relay if MCR = 1. If
MCR = 0, then the value 0 is written to the addressed bit instead of RLO.
Format: R <Bit>
R (reset bit) places a "0" in the addressed bit if RLO = 1 and master control relay
MCR = 1. If MCR = 0, then the addressed bit will not be changed.
Format: S <Bit>
S (set bit) places a "1" in the addressed bit if RLO = 1 and the switched on master control relay
MCR = 1. If MCR = 0, the addressed bit does not change.
Format: NOT
NOT negates the RLO.
Format: SET
SET sets the RLO to signal state "1".
Format: CLR
CLR sets the RLO to signal state "0".
SAVE: Save RLO in BR Register
Format: SAVE
SAVE saves the RLO into the BR bit. The first check bit /FC is not reset. For this reason, the status
of the BR bit is included in the AND logic operation in the next network.
The use of SAVE and a subsequent query of the BR bit in the same block or in secondary blocks is
not recommended because the BR bit can be changed by numerous instructions between the two.
It makes sense to use the SAVE instruction before exiting a block because this sets the ENO
output (= BR bit) to the value of the RLO bit and you can then add error handling of the block to
this.
Format: FN <Bit>
FN <Bit> (Negative RLO edge) detects a falling edge when the RLO transitions from "1" to "0", and
indicates this by RLO = 1.
During each program scan cycle, the signal state of the RLO bit is compared with that obtained in
the previous cycle to see if there has been a state change. The previous RLO state must be stored
in the edge flag address (<Bit>) to make the comparison. If there is a difference between current
and previous RLO "1" state (detection of falling edge), the RLO bit will be "1" after this instruction.
Note
The instruction has no point if the bit you want to monitor is in the process image because the local
data for a block are only valid during the block's runtime.
Format: FP <Bit>
FP <Bit> (Positive RLO edge) detects a rising edge when the RLO transitions from "0" to "1" and
indicates this by RLO = 1.
During each program scan cycle, the signal state of the RLO bit is compared with that obtained in
the previous cycle to see if there has been a state change. The previous RLO state must be stored
in the edge flag address (<Bit>) to make the comparison. If there is a difference between current
and previous RLO "0" state (detection of rising edge), the RLO bit will be "1" after this instruction.
Note
The instruction has no point if the bit you want to monitor is in the process image because the
local data for a block are only valid during the block's runtime.
?: I Compare Integer (16-Bit)
Format: ==I, <>I, >I, <I, >=I, <=I
The Compare Integer (16-bit) instructions compare the contents of ACCU 2-L with the contents of
ACCU 1-L .The contents of ACCU 2-L and ACCU 1-L are interpreted as 16-bit integer numbers.
The result of the comparison is indicated by the RLO and the setting of the relevant status word
bits. RLO = 1 indicates that the result of the comparison is true; RLO = 0 indicates that the result of
the comparison is false. The status word bits CC 1 and CC 0 indicate the relations ‘’less,’’ ‘’equal,’’
or ‘’greater.’’
?: D Compare Double Integer (32-Bit)
Format: ==D, <>D, >D, <D, >=D, <=D
The Compare Double Integer (32-bit) instructions compare the contents of ACCU 2 with the
contents of ACCU 1 .The contents of ACCU 2 and ACCU 1 are interpreted as 32-bit integer
numbers. The result of the comparison is indicated by the RLO and the setting of the relevant
status word bits. RLO = 1 indicates that the result of the comparison is true; RLO = 0 indicates that
the result of the comparison is false. The status word bits CC 1 and CC 0 indicate the relations
‘’less,’’ ‘’equal,’’ or ‘’greater."
?: R Compare Floating-Point Number (32-Bit)
Format: ==R, <>R, >R, <R, >=R, <=R
The Compare Floating Point Number (32-bit, IEEE 754) instructions compare the contents of
ACCU 2 with the contents of ACCU 1. The contents of ACCU 1 and ACCU 2 are interpreted as
floating-point numbers (32-bit, IEEE 754). The result of the comparison is indicated by the RLO and
the setting of the relevant status word bits. RLO = 1 indicates that the result of the comparison is
true; RLO = 0 indicates that the result of the comparison is false. The status word bits CC 1 and
CC 0 indicate the relations ‘’less," ‘’equal," or ‘’greater."
BTI: BCD to Integer (16-Bit)
Format: BTI
BTI (decimal to binary conversion of a 3-digit BCD number) interprets the contents of ACCU 1-L as
a three-digit binary coded decimal number (BCD) and converts it to a 16-bit integer. The result is
stored in the low word of accumulator 1. The high word of accumulator 1 and accumulator 2 remain
unchanged.
BCD number in ACCU 1-L: The permissible value range for the BCD number is from "-999" to
"+999". Bit 0 to bit 11 are interpreted as the value and bit 15 as the sign (0 = positive, 1= negative)
of the BCD number. Bit 12 to bit 14 are not used in the conversion. If a decimal (4 bits) of the BCD
number is in the invalid range of 10 to 15, a BCDF error occurs during attempted conversion. In
general, the CPU will go into STOP. However, you may design another error response by
programming OB121 to handle this synchronous programming error.
ITB: Integer (16-Bit) to BCD
Format: ITB
ITB (binary to decimal conversion of a 16-bit integer number) interprets the contents of ACCU 1-L
as a 16-bit integer and converts it to a three-digit binary coded decimal number (BCD). The result is
stored in the low word of accumulator 1. Bit 0 to bit 11 contain the value of the BCD number. Bit 12
to bit 15 are set to the state of the sign (0000 = positive, 1111= negative) of the BCD number. The
high word of accumulator 1 and accumulator 2 remain unchanged.
The BCD number can be in the range of "-999" to "+999." If the number is out of the permissible
range, then the status bits OV and OS are set to 1.
The instruction is executed without regard to, and without affecting, the RLO.
BTD: BCD to Integer (32-Bit)
Format: BTD
BTD (decimal to binary conversion of a 7-digit BCD number) interprets the contents of ACCU 1 as
a seven digit binary coded decimal number (BCD) and converts it to a 32-bit double integer. The
result is stored in accumulator 1. Accumulator 2 remains unchanged.
BCD number in ACCU 1: The permissible value range for the BCD number is from "-9,999,999" to
"+9,999,999". Bit 0 to bit 27 are interpreted as the value and bit 31 as the sign (0 = positive, 1=
negative) of the BCD number. Bit 28 to bit 30 are not used in the conversion.
If any decimal digit (a 4-bit tetrad of the BCD coding) is in the invalid range of 10 to 15, a BCDF
error occurs during attempted conversion. In general, the CPU will go into STOP. However, you
may design another error response by programming OB121 to handle this synchronous
programming error.
ITD: Integer (16 Bit) to Double Integer (32-Bit)
Format: ITD
ITD (conversion of a 16-bit integer number to a 32-bit integer number) interprets the contents of
ACCU 1-L as a 16-bit integer and converts it to a 32-bit double integer. The result is stored in
accumulator 1. Accumulator 2 remains unchanged.
DTB: Double Integer (32-Bit) to BCD
Format: DTB
DTB (binary to decimal conversion of a 32-bit integer number) interprets the content of ACCU 1 as
a 32-bit double integer and converts it to a seven-digit binary coded decimal number (BCD).The
result is stored in accumulator 1. Bit 0 to bit 27 contain the value of the BCD number. Bit 28 to bit
31 are set to the state of the sign of the BCD number (0000 = positive, 1111 = negative).
Accumulator 2 remains unchanged.
The BCD number can be in the range of "-9,999,999" to "+9,999,999". If the number is out of the
permissible range, then the status bits OV and OS are set to 1.
DTR: Double Integer (32-Bit) to Floating-Point (32-Bit IEEE 754)
Format: DTR
DTR (conversion of a 32-bit integer number to a 32-bit IEEE floating point number) interprets the
content of ACCU 1 as a 32-bit double integer and converts it to a 32-bit IEEE floating point number.
If necessary, the instruction rounds the result. (A 32-bit integer has a higher accuracy than a 32-bit
floating point number). The result is stored in accumulator 1.
INVI: Ones Complement Integer (16-Bit)
Format: INVI
INVI (ones complement integer) forms the ones complement of the 16-bit value in ACCU 1-L.
Forming the ones complement inverts the value bit by bit, that is, zeros replace ones and ones
replace zeros. The result is stored in the low word of accumulator 1.
INVD: Ones Complement Double Integer (32-Bit)
Format: INVD
INVD (ones complement double integer) forms the ones complement of the 32-bit value in ACCU
1. Forming the ones complement inverts the value bit by bit, that is, zeros replace ones, and ones
replace zeros. The result is stored in accumulator 1.
NEGI: Twos Complement Integer (16-Bit)
Format: NEGI
NEGI (twos complement integer) forms the twos complement of the 16-bit value in ACCU 1-L.
Forming the twos complement inverts the value bit by bit, that is, zeros replace ones and ones
replace zeros; then a "1" is added. The result is stored in the low word of accumulator 1. The twos
complement instruction is equivalent to multiplication by "-1." The status bits CC 1, CC 0, OS, and
OV are set as a function of the result of the operation.
NEGD: Twos Complement Double Integer (32-Bit)
Format: NEGD
NEGD (twos complement double integer) forms the twos complement of the 32-bit value in ACCU
1. Forming the twos complement inverts the value bit by bit, that is, zeros replace ones and ones
replace zeros; then a "1" is added. The result is stored in accumulator 1. The twos complement
instruction is equivalent to a multiplication by "-1" The instruction is executed without regard to, and
without affecting, the RLO. The status bits CC 1, CC 0, OS, and OV are set as a function of the
result of the operation.
NEGR: Negate Floating-Point Number (32-Bit, IEEE 754)
Format: NEGR
NEGR (negate 32-bit IEEE floating-point number) negates the floating-point number (32-bit, IEEE
754) in ACCU 1. The instruction inverts the state of bit 31 in ACCU 1 (sign of the mantissa). The
result is stored in accumulator 1.
CAW: Change Byte Sequence in ACCU 1-L (16-Bit)
Format: CAW
CAW reverses the sequence of bytes in ACCU 1-L. The result is stored in the low word of
accumulator 1. The high word of accumulator 1 and accumulator 2 remain unchanged.
CAD: Change Byte Sequence in ACCU 1 (32-Bit)
Format: CAD
CAD reverses the sequence of bytes in ACCU 1. The result is stored in accumulator 1.
Accumulator 2 remains unchanged.
Format: RND
RND (conversion of a 32-bit IEEE floating-point number to 32-bit integer) interprets the contents of
ACCU 1 as a 32-bit IEEE floating-point number (32-bit, IEEE 754). The instruction converts the 32-
bit IEEE floating-point number to a 32-bit integer (double integer) and rounds the result to the
nearest whole number. If the fractional part of the converted number is midway between an even
and an odd result, the instruction chooses the even result. If the number is out of the permissible
range, then the status bits OV and OS are set to 1. The result is stored in accumulator 1.
Conversion is not performed and an overflow indicated in the event of a fault (utilization of a NaN or
a floating-point number that cannot be represented as a 32-bit integer number).
Format: TRUNC
TRUNC (conversion of a 32-bit IEEE floating-point number to 32-bit integer) interprets the contents
of ACCU 1 as a 32-bit IEEE floating-point number. The instruction converts the 32-bit IEEE
floating-point number to a 32-bit integer (double integer). The result is the whole number part of the
floating-point number to be converted (IEEE rounding mode "round to zero"). If the number is out of
the permissible range, then the status bits OV and OS are set to 1. The result is stored in
accumulator 1.
Conversion is not performed and an overflow indicated in the event of a fault (utilization of a NaN or
a floating-point number that cannot be represented as a 32-bit integer number).
RND+: Round to Upper Double Integer
Format: RND+
RND+ (conversion of a 32-bit IEEE floating-point number to 32-bit integer) interprets the contents
of ACCU 1 as a 32-bit IEEE floating-point number. The instruction converts the 32-bit IEEE
floating-point number to a 32-bit integer (double integer) and rounds the result to the smallest
whole number greater than or equal to the floating-point number that is converted (IEEE rounding
mode "round to +infinity"). If the number is out of the permissible range, then the status bits OV and
OS are set to 1.The result is stored in accumulator 1.
Conversion is not performed and an overflow is indicated in the event of a fault (utilization of a NaN
or a floating-point number that cannot be represented as a 32-bit integer number.)
RND-: Round to Lower Double Integer
Format: RND-
RND- (conversion of a 32-bit IEEE floating-point number to 32-bit integer) interprets the contents of
ACCU 1 as 32-bit IEEE floating-point number. The instruction converts the 32-bit IEEE floating-
point number to a 32-bit integer (double integer) and rounds the result to the largest whole number
less than or equal to the floating-point number that is converted (IEEE rounding mode "round to -
infinity"). If the number is out of the permissible range, then the status bits OV and OS are set to 1.
The result is stored in accumulator 1.
Conversion is not performed and an overflow indicated in the event of a fault (utilization of a NaN or
a floating-point number that cannot be represented as a 32-bit integer number.)
FR: Enable Counter (Free)
Format: FR <counter>
When RLO transitions from "0" to "1", FR <counter> clears the edge-detecting flag that is used for
setting and selecting upwards or downwards count of the addressed counter. Enable counter is not
required to set a counter or for normal counting This means that in spite of a constant RLO of 1 for
the Set Counter Preset Value, Counter Up, or Counter Down, these instructions are not executed
again after the enable.
L: Load Current Counter Value into ACCU 1
Format: L <counter>
L <counter> loads the current count of the addressed counter as an integer into ACCU 1-L after the
contents of ACCU 1 have been saved into ACCU 2.
LC: Load Current Counter Value into ACCU 1 as BCD
Format: LC <counter>
LC <counter> loads the count of the addressed counter as a BCD number into ACCU 1 after the
old contents of ACCU 1 have been saved into ACCU 2.
Format: R <counter>
R <counter> loads the addressed counter with "0" if RLO=1.
S: Set Counter Preset Value
Format: S <counter>
S <counter> loads the count from ACCU 1-L into the addressed counter when the RLO transitions
from "0" to "1". The count in ACCU 1 must be a BCD number between "0" and "999".
Format: CU <counter>
CU <counter> increments the count of the addressed counter by 1 when RLO transitions from "0"
to "1" and the count is less than "999". When the count reaches its upper limit of "999",
incrementing stops. Additional transitions of RLO have no effect and overflow OV bit is not set.
Format: CD <counter>
CD <counter> decrements the count of the addressed counter by 1 when RLO transitions from "0"
to "1" and the count is greater than 0. When the count reaches its lower limit of "0", decrementing
stops. Additional transitions of RLO have no effect as the counter will not count with negative
values.
Format: OPN <data block>
OPN <data block> opens a data block as a shared data block or as an instance data block. One
shared data block and one instance data block can be open at the same time.
CDB: Exchange Shared DB and Instance DB
Format: CDB
CDB is used to exchange the shared data block and instance data block. The instruction swaps the
data block registers. A shared data block becomes an instance data block and vice-versa.
L: DBLG Load Length of Shared DB in ACCU 1
Format: L DBLG
L DBLG (load length of shared data block) loads the length of the shared data block into ACCU 1
after the contents of ACCU 1 have been saved into ACCU 2.
L: DBNO Load Number of Shared DB in ACCU 1
Format: L DBNO
L DBNO (load number of shared data block) loads the number of the shared open data block into
ACCU 1-L after the content of ACCU 1 has been saved into ACCU 2.
L: DILG Load Length of Instance DB in ACCU 1
Format: L DILG
L DILG (load length of instance data block) loads the length of the instance data block into
ACCU 1-L after the content of ACCU 1 has been saved into ACCU 2.
L: DINO Load Number of Instance DB in ACCU 1
Format: L DINO
L DINO (load number of instance data block) loads the number of the opened instance data block
into ACCU 1 after the content of ACCU 1 has been saved into ACCU 2.
Format: JU <jump label>
JU <jump label> interrupts the linear program scan and jumps to a jump destination, regardless of
the status word contents. The linear program scan resumes at the jump destination. The jump
destination is specified by a jump label. Both forward and backward jumps are possible. Jumps
may be executed only within a block, that is, the jump instruction and the jump destination must lie
within one and the same block. The jump destination must be unique within this block. The
maximum jump distance is -32768 or +32767 words of program code. The actual maximum
number of statements you can jump over depends on the mix of the statements used in your
program (one-, two-, or three word statements).
Format: JL <jump label>
JL <jump label> (jump via jump to list) enables multiple jumps to be programmed. The jump target
list, with a maximum of 255 entries, begins on the next line after the JL instruction and ends on the
line before the jump label referenced in the JL address. Each jump destination consists of one JU
instruction. The number of jump destinations (0 to 255) is taken from ACCU 1-L-L.
The JL instruction jumps to one of the JU instructions as long as the contents of the ACCU is
smaller than the number of jump destinations between the JL instruction and the jump label. The
first JU instruction is jumped to if ACCU 1-L-L=0. The second JU instruction is jumped to if ACCU
1-L-L=1, etc. The JL instruction jumps to the first instruction after the last JU instruction in the
destination list if the number of jump destinations is too large.
The jump destination list must consist of JU instructions which precede the jump label referenced
in the address of the JL instruction. Any other instruction within the jump list is illegal.
Format: JC <jump label>
If the result of logic operation is 1, JC <jump label> interrupts the linear program scan and jumps
to a jump destination. The linear program scan resumes at the jump destination. The jump
destination is specified a jump label. Both forward and backward jumps are possible. Jumps may
be executed only within a block, that is, the jump instruction and the jump destination must lie
within one and the same block. The jump destination must be unique within this block. The
maximum jump distance is -32768 or +32767 words of program code. The actual maximum
number of statements you can jump over depends on the mix of the statements used in your
program (one-, two-, or three word statements).
If the result of logic operation is 0, the jump is not executed. The RLO is set to 1, and the program
scan continues with the next statement.
Format: JCN <jump label>
If the result of logic operation is 0, JCN <jump label> interrupts the linear program scan and jumps
to a jump destination. The linear program scan resumes at the jump destination. The jump
destination is specified by a jump label. Both forward and backward jumps are possible. Jumps
may be executed only within a block, that is, the jump instruction and the jump destination must lie
within one and the same block. The jump destination must be unique within this block. The
maximum jump distance is -32768 or +32767 words of program code. The actual maximum
number of statements you can jump over depends on the mix of the statements used in your
program (one-, two-, or three word statements).
If the result of logic operation is 1, the jump is not executed. The program scan continues with the
next statement.
JCB: Jump if RLO = 1 with BR
Format: JCB <jump label>
If the result of logic operation is 1, JCB <jump label> interrupts the linear program scan and jumps
to a jump destination. The linear program scan resumes at the jump destination. The jump
destination is specified by a jump label. Both forward and backward jumps are possible. Jumps
may be executed only within a block, that is, the jump instruction and the jump destination must lie
within one and the same block. The jump destination must be unique within this block. The
maximum jump distance is -32768 or +32767 words of program code. The actual maximum
number of statements you can jump over depends on the mix of the statements used in your
program (one-, two-, or three word statements).
If the result of logic operation is 0, the jump is not executed. The RLO is set to 1, and the program
scan continues with the next statement.
Independent of the RLO, the RLO is copied into the BR for the JCB <jump label> instruction.
JNB: Jump if RLO = 0 with BR
Format: JNB <jump label>
If the result of logic operation is 0, JNB <jump label> interrupts the linear program scan and jumps
to a jump destination. The linear program scan resumes at the jump destination. The jump
destination is specified by a jump label. Both forward and backward jumps are possible. Jumps
may be executed only within a block, that is, the jump instruction and the jump destination must lie
within one and the same block. The jump destination must be unique within this block. The
maximum jump distance is -32768 or +32767 words of program code. The actual maximum
number of statements you can jump over depends on the mix of the statements used in your
program (one-, two-, or three word statements).
If the result of logic operation is 1, the jump is not executed. The RLO is set to 1 and the program
scan continues with the next statement.
Independent of the RLO, the RLO is copied into the BR when there is a JNB <jump label>
instruction.
Format: JBI <jump label>
If status bit BR is 1, JBI <jump label> interrupts the linear program scan and jumps to a jump
destination. The linear program scan resumes at the jump destination. The jump destination is
specified by a jump label. A jump label may be as many as four characters, and the first character
must be a letter. Jump labels are followed with a mandatory colon ":" and must precede the
program statement in a line. Both forward and backward jumps are possible. Jumps may be
executed only within a block, that is, the jump instruction and the jump destination must lie within
one and the same block. The jump destination must be unique within this block. The maximum
jump distance is -32768 or +32767 words of program code. The actual maximum number of
statements you can jump over depends on the mix of the statements used in your program (one-,
two-, or three word statements).
Format: JNBI <jump label>
If status bit BR is 0, JNBI <jump label> interrupts the linear program scan and jumps to a jump
destination. The linear program scan resumes at the jump destination. The jump destination is
specified by a jump label. Both forward and backward jumps are possible. Jumps may be executed
only within a block, that is, the jump instruction and the jump destination must lie within one and the
same block. The jump destination must be unique within this block. The maximum jump distance is
-32768 or +32767 words of program code. The actual maximum number of statements you can
jump over depends on the mix of the statements used in your program (one-, two-, or three word
statements).
Format: JO <jump label>
If status bit OV is 1, JO <jump label> interrupts the linear program scan and jumps to a jump
destination. The linear program scan resumes at the jump destination. The jump destination is
specified by a jump label. Both forward and backward jumps are possible. Jumps may be executed
only within a block, that is, the jump instruction and the jump destination must lie within one and the
same block. The jump destination must be unique within this block. The maximum jump distance is
-32768 or +32767 words of program code. The actual maximum number of statements you can
jump over depends on the mix of the statements used in your program (one-, two-, or three word
statements). In a combined math instruction, check for overflow after each separate math
instruction to ensure that each intermediate result is within the permissible range, or use instruction
JOS.
Format: JOS <jump label>
If status bit OS is 1, JOS <jump label> interrupts the linear program scan and jumps to a jump
destination. The linear program scan resumes at the jump destination. The jump destination is
specified by a jump label. Both forward and backward jumps are possible. Jumps may be executed
only within a block, that is, the jump instruction and the jump destination must lie within one and the
same block. The jump destination must be unique within this block. The maximum jump distance is
-32768 or +32767 words of program code. The actual maximum number of statements you can
jump over depends on the mix of the statements used in your program (one-, two-, or three word
statements).
Format: JZ <jump label>
If status bits CC 1 = 0 and CC 0 = 0, JZ <jump label> (jump if result = 0) interrupts the linear
program scan and jumps to a jump destination. The linear program scan resumes at the jump
destination. The jump destination is specified by a jump label. Both forward and backward jumps
are possible. Jumps may be executed only within a block, that is, the jump instruction and the jump
destination must lie within one and the same block. The jump destination must be unique within this
block. The maximum jump distance is -32768 or +32767 words of program code. The actual
maximum number of statements you can jump over depends on the mix of the statements used in
your program (one-, two-, or three word statements).
Format: JN <jump label>
If the result indicated by the status bits CC 1 and CC 0 is greater or less than zero (CC 1=0/CC 0=1
or CC 1=1/CC 0=0), JN <jump label> (jump if result <> 0) interrupts the linear program scan and
jumps to a jump destination. The linear program scan resumes at the jump destination. The jump
destination is specified by a jump label. Both forward and backward jumps are possible. Jumps
may be executed only within a block, that is, the jump instruction and the jump destination must lie
within one and the same block. The jump destination must be unique within this block. The
maximum jump distance is -32768 or +32767 words of program code. The actual maximum
number of statements you can jump over depends on the mix of the statements used in your
program (one-, two-, or three word statements).
Format: JP <jump label>
If status bits CC 1 = 1 and CC 0 = 0, JP <jump label> (jump if result < 0) interrupts the linear
program scan and jumps to a jump destination. The linear program scan resumes at the jump
destination. The jump destination is specified by a jump label. Both forward and backward jumps
are possible. Jumps may be executed only within a block, that is, the jump instruction and the jump
destination must lie within one and the same block. The jump destination must be unique within this
block. The maximum jump distance is -32768 or +32767 words of program code. The actual
maximum number of statements you can jump over depends on the mix of the statements used in
your program (one-, two-, or three word statements).
Format: JM <jump label>
If status bits CC 1 = 0 and CC 0 = 1, JM <jump label> (jump if result < 0) interrupts the linear
program scan and jumps to a jump destination. The linear program scan resumes at the jump
destination. The jump destination is specified by a jump label. Both forward and backward jumps
are possible. Jumps may be executed only within a block, that is, the jump instruction and the jump
destination must lie within one and the same block. The jump destination must be unique within this
block. The maximum jump distance is -32768 or +32767 words of program code. The actual
maximum number of statements you can jump over depends on the mix of the statements used in
your program (one-, two-, or three word statements).
JPZ: Jump if Plus or Zero
Format: JPZ <jump label>
If the result indicated by the status bits CC 1 and CC 0 is greater than or equal to zero (CC 1=0/CC
0=0 or CC 1=1/CC 0=0), JPZ <jump label> (jump if result >= 0) interrupts the linear program scan
and jumps to a jump destination. The linear program scan resumes at the jump destination. The
jump destination is specified by a jump label. Both forward and backward jumps are possible.
Jumps may be executed only within a block, that is, the jump instruction and the jump destination
must lie within one and the same block. The jump destination must be unique within this block. The
maximum jump distance is -32768 or +32767 words of program code. The actual maximum
number of statements you can jump over depends on the mix of the statements used in your
program (one-, two-, or three word statements).
JMZ: Jump if Minus or Zero
Format: JMZ <jump label>
If the result indicated by the status bits CC 1 and CC 0 is less than or equal to zero (CC 1=0/CC
0=0 or CC 1=0/CC 0=1), JMZ <jump label> (jump if result <= 0) interrupts the linear program scan
and jumps to a jump destination. The linear program scan resumes at the jump destination. The
jump destination is specified by a jump label. Both forward and backward jumps are possible.
Jumps may be executed only within a block, that is, the jump instruction and the jump destination
must lie within one and the same block. The jump destination must be unique within this block. The
maximum jump distance is -32768 or +32767 words of program code. The actual maximum
number of statements you can jump over depends on the mix of the statements used in your
program (one-, two-, or three word statements).
Format: JUO <jump label>
If status bits CC 1 = 1 and CC 0 = 1, JUO <jump label> interrupts the linear program scan and
jumps to a jump destination. The linear program scan resumes at the jump destination. The jump
destination is specified by a jump label. Both forward and backward jumps are possible. Jumps
may be executed only within a block, that is, the jump instruction and the jump destination must lie
within one and the same block. The jump destination must be unique within this block. The
maximum jump distance is -32768 or +32767 words of program code. The actual maximum
number of statements you can jump over depends on the mix of the statements used in your
program (one-, two-, or three word statements).
Format: LOOP <jump label>
LOOP <jump label> (decrement ACCU 1-L and jump if ACCU 1-L <> 0) simplifies loop
programming. The loop counter is accommodated in ACCU 1-L. The instruction jumps to the
specified jump destination. The jump is executed as long as the content of ACCU 1-L is not equal
to 0. The linear program scan resumes at the jump destination. The jump destination is specified by
a jump label. Both forward and backward jumps are possible. Jumps may be executed only within a
block, that is, the jump instruction and the jump destination must lie within one and the same block.
The jump destination must be unique within this block. The maximum jump distance is -32768 or
+32767 words of program code. The actual maximum number of statements you can jump over
depends on the mix of the statements used in your program (one-, two-, or three word statements).
+I: Add ACCU 1 and ACCU 2 as Integer (16-Bit)
Format: +I
+I (add 16-bit integer numbers) adds the contents of ACCU 1-L to the contents of ACCU 2-L and
stores the result in ACCU 1-L. The contents of ACCU 1-L and ACCU 2-L are interpreted as 16-bit
integer numbers. The instruction is executed without regard to, and without affecting, the RLO. The
status word bits CC 1, CC 0, OS, and OV are set as a function of the result of the instruction. The
instruction produces a 16-bit integer number instead of an 32-bit integer number in the event of an
overflow/underflow.
The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.
The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4
are copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain
unchanged.
See also Evaluating the Bits of the Status Word with Integer Math Instructions.
-I: Subtract ACCU 1 from ACCU 2 as Integer (16-Bit)
Format: -I
-I (subtract 16-bit integer numbers) subtracts the contents of ACCU 1-L from the contents of ACCU
2-L and stores the result in ACCU 1-L. The contents of ACCU 1-L and ACCU 2-L are interpreted as
16-bit integer numbers. The instruction is executed without regard to, and without affecting, the
RLO. The status word bits CC 1, CC 0, OS, and OV are set as a function of the result of the
instruction. The instruction produces a 16-bit integer number instead of an 32-bit integer number in
the event of an overflow/underflow.
The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.
The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4
are copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain
unchanged.
See also Evaluating the Bits of the Status Word with Integer Math Instructions.
*I: Multiply ACCU 1 and ACCU 2 as Integer (16-Bit)
Format: *I
*I (multiply 16-bit integer numbers) multiplies the contents of ACCU 2-L by the contents of ACCU 1-
L. The contents of ACCU 1-L and ACCU 2-L are interpreted as 16-bit integer numbers. The result
is stored in accumulator 1 as a 32-bit integer number. If the status word bits are OV1 = 1 and OS =
1, the result is outside the range of a 16-bit integer number.
The instruction is executed without regard to, and without affecting, the RLO. The status word bits
CC 1, CC 0, OS, and OV are set as a function of the result of the instruction.
The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.
The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4
are copied into accumulator 3 for CPUs with four ACCUs.
See also Evaluating the Bits of the Status Word with Integer Math Instructions.
/I: Divide ACCU 2 by ACCU 1 as Integer (16-Bit)
Format: /I
/I (divide 16-bit integer numbers) divides the contents of ACCU 2-L by the contents of ACCU 1-L.
The contents of ACCU 1-L and ACCU 2-L are interpreted as 16-bit integer numbers. The result is
stored in accumulator 1 and consists of two 16-bit integer numbers, the quotient, and the
remainder. The quotient is stored in ACCU 1-L and the remainder in ACCU 1-H. The instruction is
executed without regard to, and without affecting, the RLO. The status word bits CC 1, CC 0, OS,
and OV are set as a function of the result of the instruction.
The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.
The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4
are copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain
unchanged.
See also Evaluating the Bits of the Status Word with Integer Math Instructions.
+: Add Integer Constant (16, 32-Bit)
Format: + <integer constant>
+ <integer constant> adds the integer constant to the contents of ACCU 1 and stores the result in
ACCU 1. The instruction is executed without regard to, and without affecting, the status word bits.
+ <16-bit integer constant>: Adds a 16-bit integer constant (in the range of -32768 to +32767) to
the contents of ACCU 1-L and stores the result in ACCU 1-L.
+ <32-bit integer constant>: Adds a 32-bit integer constant (in the range of - 2,147,483,648 to
2,147,483,647) to the contents of ACCU 1 and stores the result in ACCU 1.
+D: Add ACCU 1 and ACCU 2 as Double Integer (32-Bit)
Format: +D
+D (add 32-bit integer numbers) adds the contents of ACCU 1 to the contents of ACCU 2 and
stores the result in ACCU 1. The contents of ACCU 1 and ACCU 2 are interpreted as 32-bit integer
numbers. The instruction is executed without regard to, and without affecting, the RLO. The status
word bits CC 1, CC 0, OS, and OV are set as a function of the result of the instruction.
The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.
The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4
are copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain
unchanged.
See also Evaluating the Bits of the Status Word with Integer Math Instructions.
-D: Subtract ACCU 1 from ACCU 2 as Double Integer (32-Bit)
Format: -D
-D (subtract 32-bit integer numbers) subtracts the contents of ACCU 1 from the contents of ACCU
2 and stores the result in ACCU 1. The contents of ACCU 1 and ACCU 2 are interpreted as 32-bit
integer numbers. The instruction is executed without regard to, and without affecting, the RLO. The
status word bits CC 1, CC 0, OS, and OV are set as a function of the result of the instruction.
The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.
The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4
are copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain
unchanged.
See also Evaluating the Bits of the Status Word with Integer Math Instructions.
*D: Multiply ACCU 1 and ACCU 2 as Double Integer (32-Bit)
Format: *D
*D (multiply 32-bit integer numbers) multiplies the contents of ACCU 2 by the contents of ACCU 1.
The contents of ACCU 1 and ACCU 2 are interpreted as 32-bit integer numbers. The result is
stored in accumulator 1 as a 32-bit integer number. If the status word bits are OV1 = 1 and OS = 1,
the result is outside the range of a 32-bit integer number.
The instruction is executed without regard to, and without affecting, the RLO. The status word bits
CC 1, CC 0, OS, and OV are set as a function of the result of the instruction.
The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.
The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4
are copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain
unchanged.
See also Evaluating the Bits of the Status Word with Integer Math Instructions.
/D: Divide ACCU 2 by ACCU 1 as Double Integer (32-Bit)
Format: /D
/D (divide 32-bit integer numbers) divides the contents of ACCU 2 by the contents of ACCU 1. The
contents of ACCU 1 and ACCU 2 are interpreted as 32-bit integer numbers. The result of the
instruction is stored in accumulator 1. The result gives only the quotient and not the remainder.
(The instruction MOD can be used to get the remainder.)
The instruction is executed without regard to, and without affecting, the RLO. The status word bits
CC 1, CC 0, OS, and OV are set as a function of the result of the instruction.
The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.
The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4
are copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain
unchanged.
See also Evaluating the Bits of the Status Word with Integer Math Instructions.
MOD: Division Remainder Double Integer (32-Bit)
Format: MOD
MOD (remainder of the division of 32-bit integer numbers) divides the contents of ACCU 2 by the
contents of ACCU 1. The contents of ACCU 1 and ACCU 2 are interpreted as 32-bit integer
numbers. The result of the instruction is stored in accumulator 1. The result gives only the division
remainder, and not the quotient. (The instruction /D can be used to get the quotient.)
The instruction is executed without regard to, and without affecting, the RLO. The status word bits
CC 1, CC 0, OS, and OV are set as a function of the result of the instruction.
The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.
The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4
are copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain
unchanged.
Format: L <address>
L <address> loads the addressed byte, word, or double word into ACCU 1 after the old contents of
ACCU 1 have been saved into ACCU 2, and ACCU 1 is reset to "0".
L: STW Load Status Word into ACCU 1
Format: L STW
L STW (instruction L with the address STW) loads ACCU 1 with the contents of the status word.
The instruction is executed without regard to, and without affecting, the status bits.
Note
For the S7-300 series CPUs, the statement L STW does not load the FC, STA, and OR bits of
the status word. Only bits 1, 4, 5, 6, 7, and 8 are loaded into the corresponding bit positions of
the low word of accumulator 1.
LAR1: Load Address Register 1 from ACCU 1
Format: LAR1
LAR1 loads address register AR1 with the contents of ACCU 1 (32-bit pointer). ACCU 1 and ACCU
2 remain unchanged. The instruction is executed without regard to, and without affecting, the status
bits.
LAR1: AR2 Load Address Register 1 from Address Register 2
Format: LAR1 AR2
LAR1 AR2 (instruction LAR1 with the address AR2) loads address register AR1 with the contents
of address register AR2. ACCU 1 and ACCU 2 remain unchanged. The instruction is executed
without regard to, and without affecting, the status bits.
LAR2: Load Address Register 2 from ACCU 1
Format: LAR2
LAR2 loads address register AR2 with the contents ACCU 1 (32-bit pointer).
ACCU 1 and ACCU 2 remain unchanged. The instruction is executed without regard to, and
without affecting, the status bits.
Format: T <address>
T <address> transfers (copies) the contents of ACCU 1 to the destination address if the Master
Control Relay is switched on (MCR = 1). If MCR = 0, then the destination address is written with 0.
The number of bytes copied from ACCU 1 depends on the size expressed in the destination
address. ACCU 1 also saves the data after the transfer procedure. A transfer to the direct I/O area
(memory type PQ) also transfers the contents of ACCU 1 or "0" (if MCR=0) to the corresponding
address of the process image output table (memory type Q). The instruction is executed without
regard to, and without affecting, the status bits.
T: STW Transfer ACCU 1 into Status Word
Format: T STW
T STW (instruction T with the address STW) transfers bit 0 to bit 8 of ACCU 1 into the status word.
The instruction is executed without regard to the status bits.
Note: With the CPUs of the S7-300 family, the bits of the status word /ER, STA and OR are not
written to by the T STW instruction. Only bits 1, 4, 5, 6, 7 and 8 are written according to the bit
settings of ACCU1.
CAR: Exchange Address Register 1 with Address Register 2
Format: CAR
CAR (swap address register) exchanges the contents of address registers AR1 and AR2. The
instruction is executed without regard to, and without affecting, the status bits.
The contents of address register AR1 are moved to address register AR2 and
the contents of address register AR2 are moved to address register AR1.
TAR1: Transfer Address Register 1 to ACCU 1
Format: TAR1
TAR1 transfers the contents of address register AR1 into ACCU 1 (32-bit pointer). The previous
contents of ACCU 1 are saved into ACCU 2. The instruction is executed without regard to, and
without affecting, the status bits.
TAR1: AR2 Transfer Address Register 1 to Address Register 2
Format: TAR1 AR2
TAR1 AR2 (instruction TAR1 with the address AR2) transfers the contents of address register AR1
to address register AR2.
ACCU 1 and ACCU 2 remain unchanged. The instruction is executed without regard to, and
without affecting, the status bits.
TAR2: Transfer Address Register 2 to ACCU 1
Format: TAR2
TAR2 transfers the contents of address register AR2 into ACCU 1 (32-bit pointer). The contents of
ACCU 1 were previously saved into ACCU 2. The instruction is executed without regard to, and
without affecting, the status bits.
Format: BE
BE (block end) terminates the program scan in the current block and causes a jump to the block
that called the current block. The program scan resumes with the first instruction that follows the
block call statement in the calling program. The current local data area is released and the previous
local data area becomes the current local data area. The data blocks that were opened when the
block was called are re-opened. In addition, the MCR dependency of the calling block is restored
and the RLO is carried over from the current block to the block that called the current block. BE is
not dependent on any conditions. However, if the BE instruction is jumped over, the current
program scan does not end and will continue starting at the jump destination within the block.
The BE instruction is not identical to the S5 software. The instruction has the same function as
BEU when used on S7 hardware.
BEC: Block End Conditional
Format: BEC
If RLO = 1, then BEC (block end conditional) interrupts the program scan in the current block and
causes a jump to the block that called the current block. The program scan resumes with the first
instruction that follows the block call. The current local data area is released and the previous local
data area becomes the current local data area. The data blocks that were current data blocks when
the block was called are re-opened. The MCR dependency of the calling block is restored.
The RLO (= 1) is carried over from the terminated block to the block that called. If RLO = 0, then
BEC is not executed. The RLO is set to 1 and the program scan continues with the instruction
following BEC.
BEU: Block End Unconditional
Format: BEU
BEU (block end unconditional) terminates the program scan in the current block and causes a jump
to the block that called the current block. The program scan resumes with the first instruction that
follows the block call. The current local data area is released and the previous local data area
becomes the current local data area. The data blocks that were opened when the block was called
are re-opened. In addition, the MCR dependency of the calling block is restored and the RLO is
carried over from the current block to the block that called the current block. BEU is not dependent
on any conditions. However, if the BEU instruction is jumped over, the current program scan does
not end and will continue starting at the jump destination within the block.
Format: CALL <logic block identifier>
Format: CALL FB n1, DB n1
This instruction is intended to call user-defined function blocks (FBs). The CALL instruction calls
the function block you entered as address, independent of the RLO or other conditions. If you call a
function block with CALL, you must provide it with an instance data block. After processing the
called block, processing continues with the program for the calling block. The address for the logic
block can be specified absolutely or symbolically.
Passing parameters (incremental edit mode)
The calling block can exchange parameters with the called block via the variable list. The variable
list is extended automatically in your Statement List program when you enter a valid CALL
instruction.
If you call a function block and the variable declaration table of the called block has IN, OUT, and
IN_OUT declarations, these variables are added in the program for the calling block as a list of
formal parameters.
When calling the function block, you only need to specify the actual parameters that must be
changed from the previous call because the actual parameters are saved in the instance data block
after the function block is processed. If the actual parameter is a data block, the complete, absolute
address must be specified, for example DB1, DBW2.
The IN parameters can be specified as constants or as absolute or symbolic addresses. The OUT
and IN_OUT parameters must be specified as absolute or symbolic addresses. You must ensure
that all addresses and constants are compatible with the data types to be transferred.
CALL saves the return address (selector and relative address), the selectors of the two open data
blocks, and the MA bit in the B (block) stack. In addition, CALL deactivates the MCR dependency,
and then creates the local data area of the block to be called.
Format: CALL FC n
This instruction is intended to call functions (FCs). The CALL instruction calls the FC that you
entered as address, independent of the RLO or other conditions. After processing the called block,
processing continues with the program for the calling block. The address for the logic block can be
specified absolutely or symbolically.
Passing parameters (incremental edit mode)
The calling block can exchange parameters with the called block via the variable list. The variable
list is extended automatically in your Statement List program when you enter a valid CALL
instruction.
If you call a function and the variable declaration table of the called block has IN, OUT, and
IN_OUT declarations, these variables are added in the program for the calling block as a list of
formal parameters.
When calling the function, you must assign actual parameters in the calling logic block to the formal
parameters.
The IN parameters can be specified as constants or as absolute or symbolic addresses. The OUT
and IN_OUT parameters must be specified as absolute or symbolic addresses. You must ensure
that all addresses and constants are compatible with the data types to be transferred.
CALL saves the return address (selector and relative address), the selectors of the two open data
blocks, and the MA bit in the B (block) stack. In addition, CALL deactivates the MCR dependency,
and then creates the local data area of the block to be called.
Format: CALL SFB n1, DB n2
This instruction is intended to call the standard function blocks (SFBs) supplied by Siemens. The
CALL instruction calls the SFB that you entered as address, independent of the RLO or other
conditions. If you call a system function block with CALL, you must provide it with an instance data
block. After processing the called block, processing continues with the program for the calling
block. The address for the logic block can be specified absolutely or symbolically.
Passing parameters (incremental edit mode)
The calling block can exchange parameters with the called block via the variable list. The variable
list is extended automatically in your Statement List program when you enter a valid CALL
instruction.
If you call a system function block and the variable declaration table of the called block has IN,
OUT, and IN_OUT declarations, these variables are added in the program for the calling block as a
list of formal parameters.
When calling the system function block, you only need to specify the actual parameters that must
be changed from the previous call because the actual parameters are saved in the instance data
block after the system function block is processed. If the actual parameter is a data block, the
complete, absolute address must be specified, for example DB1, DBW2.
The IN parameters can be specified as constants or as absolute or symbolic addresses. The OUT
and IN_OUT parameters must be specified as absolute or symbolic addresses. You must ensure
that all addresses and constants are compatible with the data types to be transferred.
CALL saves the return address (selector and relative address), the selectors of the two open data
blocks, and the MA bit in the B (block) stack. In addition, CALL deactivates the MCR dependency,
and then creates the local data area of the block to be called.
Format: CALL SFC n
This instruction is intended to call the standard functions (SFCs) supplied by Siemens. The CALL
instruction calls the SFC that you entered as address, independent of the RLO or other conditions.
After processing the called block, processing continues with the program for the calling block. The
address for the logic block can be specified absolutely or symbolically.
Passing parameters (incremental edit mode)
The calling block can exchange parameters with the called block via the variable list. The variable
list is extended automatically in your Statement List program when you enter a valid CALL
instruction.
If you call a system function and the variable declaration table of the called block has IN, OUT, and
IN_OUT declarations, these variables are added in the program for the calling block as a list of
formal parameters.
When calling the system function, you must assign actual parameters in the calling logic block to
the formal parameters.
The IN parameters can be specified as constants or as absolute or symbolic addresses. The OUT
and IN_OUT parameters must be specified as absolute or symbolic addresses. You must ensure
that all addresses and constants are compatible with the data types to be transferred.
CALL saves the return address (selector and relative address), the selectors of the two open data
blocks, and the MA bit in the B (block) stack. In addition, CALL deactivates the MCR dependency,
and then creates the local data area of the block to be called.
Format: CALL # variable name
A multiple instance is created by declaring a static variable with the data type of a function block.
Only multiple instances that have already been declared are included in the program element
catalog.
Format: CC <logic block identifier>
CC <logic block identifier> (conditional block call) calls a logic block if RLO=1. CC is used to call
logic blocks of the FC or FB type without parameters. CC is used in the same way as the CALL
instruction except that you cannot transfer parameters with the calling program. The instruction
saves the return address (selector and relative address), the selectors of the two current data
blocks, as well as the MA bit into the B (block) stack, deactivates the MCR dependency, creates
the local data area of the block to be called, and begins executing the called code. The address for
the logic block can be specified absolutely or symbolically.
Format: UC <logic block identifier>
UC <logic block identifier> (unconditional block call) calls a logic block of the FC or SFC type. UC
is like the CALL instruction, except that you cannot transfer parameters with the called block. The
instruction saves the return address (selector and relative address) selectors of the two current
data blocks, as well as the MA bit into the B (block) stack, deactivates the MCR dependency,
creates the local data area of the block to be called, and begins executing the called code.
Format: FR <timer>
When the RLO transitions from "0" to "1", FR <timer> clears the edge-detecting flag that is used
for starting the addressed timer. A change in the RLO bit from 0 to 1 in front of an enable
instruction (FR) enables a timer.
Timer enable is not required to start a timer, nor is it required for normal timer instruction. An
enable is used only to re-trigger a running timer, that is, to restart a timer. The restarting is possible
only when the start instruction continues to be processed with RLO = 1.
L: Load Current Timer Value into ACCU 1 as Integer
Format: L <timer>
L <timer> loads the current timer value from the addressed timer word without a time base as a
binary integer into ACCU 1-L after the contents of ACCU 1 have been saved into ACCU 2.
LC: Load Current Timer Value into ACCU 1 as BCD
Format: LC <timer>
LC <timer> loads the current timer value and time base from the addressed timer word as a Binary
Coded Decimal (BCD) number into ACCU 1 after the content of ACCU 1 has been saved into
ACCU 2.
Format: R <timer>
R <timer> stops the current timing function and clears the timer value and the time base of the
addressed timer word if the RLO transitions from 0 to 1.
Format: SP <timer>
SP <timer> starts the addressed timer when the RLO transitions from "0" to "1". The programmed
time elapses as long as RLO = 1. The timer is stopped if RLO transitions to "0" before the
programmed time interval has expired. This timer start command expects the time value and the
time base to be stored as a BCD number in ACCU 1-L.
See also Location of a Timer in Memory and components of a Timer.
Format: SE <timer>
SE <timer> starts the addressed timer when the RLO transitions from "0" to "1". The programmed
time interval elapses, even if the RLO transitions to "0" in the meantime. The programmed time
interval is started again if RLO transitions from "0" to "1" before the programmed time has expired.
This timer start command expects the time value and the time base to be stored as a BCD number
in ACCU 1-L.
See also Location of a Timer in Memory and components of a Timer.
Format: SD <timer>
SD <timer> starts the addressed timer when the RLO transitions from "0" to "1". The programmed
time interval elapses as long as RLO = 1. The time is stopped if RLO transitions to "0" before the
programmed time interval has expired. This timer start instruction expects the time value and the
time base to be stored as a BCD number in ACCU 1-L.
See also Location of a Timer in Memory and components of a Timer.
SS: Retentive On-Delay Timer
Format: SS <timer>
SS <timer> (start timer as a retentive ON timer) starts the addressed timer when the RLO
transitions from "0" to "1". The full programmed time interval elapses, even if the RLO transitions to
"0" in the meantime. The programmed time interval is re-triggered (started again) if RLO transitions
from "0" to "1" before the programmed time has expired. This timer start command expects the time
value and the time base to be stored as a BCD number in ACCU 1-L.
See also Location of a Timer in Memory and components of a Timer.
Format: SF <timer>
SF <timer> starts the addressed timer when the RLO transitions from "1" to "0". The programmed
time elapses as long as RLO = 0. The time is stopped if RLO transitions to "1" before the
programmed time interval has expired. This timer start command expects the time value and the
time base to be stored as a BCD number in ACCU 1-L.
See also Location of a Timer in Memory and components of a Timer.
Format: AW
AW (AND word) combines the contents of ACCU 1-L with ACCU 2-L or a 16 bit-constant bit by bit
according to the Boolean logic operation AND. A bit in the result word is "1" only when the
corresponding bits of both words combined in the logic operation are "1". The result is stored in
ACCU 1-L. ACCU 1-H and ACCU 2 (and ACCU 3 and ACCU 4 for CPUs with four ACCUs) remain
unchanged. The status bit CC 1 is set as a result of the operation (CC 1 = 1 if result is unequal to
zero). The status word bits CC 0 and OV are reset to 0.
AW: Combines ACCU 1-L with ACCU 2-L.
AW <constant>: Combines ACCU 1 with a 16-bit constant.
Format: OW
OW (OR word) combines the contents of ACCU 1-L with ACCU 2-L or a 16 bit-constant bit by bit
according to the Boolean logic operation OR. A bit in the result word is "1" when at least one of the
corresponding bits of both words combined in the logic operation is "1". The result is stored in
ACCU 1-L. ACCU 1-H and ACCU 2 (and ACCU 3 and ACCU 4 for CPUs with four ACCUs) remain
unchanged. The instruction is executed without regard to, and without affecting, the RLO. The
status bit CC 1 is set as a result of the operation (CC 1 = 1 if result is unequal to zero). The status
word bits CC 0 and OV are reset to 0.
OW: Combines ACCU 1-L with ACCU 2-L.
OW <constant>: Combines ACCU 1-L with a 16-bit constant.
XOW: Exclusive OR Word (16-Bit)
Format: XOW
XOW (XOR word) combines the contents of ACCU 1-L with ACCU 2-L or a 16 bit-constant bit by bit
according to the Boolean logic operation XOR. A bit in the result word is "1" only when one of the
corresponding bits of both words combined in the logic operation is "1". The result is stored in
ACCU 1-L. ACCU 1-H and ACCU 2 remain unchanged. The status bit CC 1 is set as a result of the
operation (CC 1 = 1 if result is unequal to zero). The status word bits CC 0 and OV are reset to 0.
You can use the Exclusive OR function several times. The result of logic operation is then "1" if an
impair number of checked addresses ist "1".
XOW: Combines ACCU 1-L with ACCU 2-L.
XOW <constant>: Combines ACCU 1-L with a 16-bit constant.
AD: AND Double Word (32-Bit)
Format: AD
AD (AND double word) combines the contents of ACCU 1 with ACCU 2 or a 32-bit constant bit by
bit according to the Boolean logic operation AND. A bit in the result double word is "1" only when
the corresponding bits of both double words combined in the logic operation are "1". The result is
stored in ACCU 1. ACCU 2 (and ACCU 3 and ACCU 4 for CPU’s with four ACCUs) remains
unchanged. The status bit CC 1 is set as a result of the operation (CC 1 = 1 if result is unequal to
zero). The status word bits CC 0 and OV are reset to 0.
AD: Combines ACCU 1 with ACCU 2.
AD <constant>: Combines ACCU 1 with a 32-bit constant.
OD: OR Double Word (32-Bit)
Format: OD
OD (OR double word) combines the contents of ACCU 1 with ACCU 2 or a 32-bit constant bit by bit
according to the Boolean logic operation OR. A bit in the result double word is "1" when at least
one of the corresponding bits of both double words combined in the logic operation is "1". The
result is stored in ACCU 1. ACCU 2 (and ACCU 3 and ACCU 4 for CPUs with four ACCUs)
remains unchanged. The status bit CC 1 is set as a function of the result of the operation (CC 1 = 1
if result is unequal to zero). The status word bits CC 0 and OV are reset to 0.
OD: Combines ACCU 1 with ACCU 2.
OD <constant>: Combines ACCU 1 with a 32-bit constant.
XOD: Exclusive OR Double Word (32-Bit)
Format: XOD
XOD (XOR double word) combines the contents of ACCU 1 with ACCU 2 or a 32-bit constant bit by
bit according to the Boolean logic operation XOR (Exclusive Or). A bit in the result double word is
"1" when only one of the corresponding bits of both double words combined in the logic operation is
"1". The result is stored in ACCU 1. ACCU 2 remains unchanged. The status bit CC 1 is set as a
result of the operation (CC 1 = 1 if result is not equal to zero). The status word bits CC 0 and OV
are reset to 0.
You can use the Exclusive OR function several times. The result of logic operation is then "1" if an
impair number of checked addresses ist "1".
XOD: Combines ACCU 1 with ACCU 2.
XOD <constant>: Combines ACCU 1 with a 32-bit constant.
TAK: Toggle ACCU 1 with ACCU 2
Format: TAK
TAK (toggle ACCU 1 with ACCU 2) exchanges the contents of ACCU 1 with the contents of ACCU
2. The instruction is executed without regard to, and without affecting, the status bits. The contents
of ACCU 3 and ACCU 4 remain unchanged for CPUs with four ACCU s.
Format: POP
POP (CPU with two ACCUs) copies the entire contents of ACCU 2 to ACCU 1. ACCU 2 remains
unchanged. The instruction is executed without regard to, and without affecting, the status bits.
Format: POP
POP (CPU with four ACCUs) copies the entire contents of ACCU 2 to ACCU 1, the contents of
ACCU 3 to ACCU 2, and the contents of ACCU 4 to ACCU 3. ACCU 4 remains unchanged. The
instruction is executed without regard to, and without affecting, the status bits.
Format: PUSH
PUSH (ACCU 1 to ACCU 2) copies the entire contents of ACCU 1 to ACCU 2. ACCU 1 remains
unchanged. The instruction is executed without regard to, and without affecting, the status bits.
PUSH: CPU with Four ACCUs
Format: PUSH
PUSH (CPU with four ACCUs) copies the contents of ACCU 3 to ACCU 4, the contents of ACCU 2
to ACCU 3, and the contents of ACCU 1 to ACCU 2. ACCU 1 remains unchanged. The instruction
is executed without regard to, and without affecting, the status bits.
Format: LEAVE
LEAVE (leave accumulator stack) copies the contents of ACCU 3 into ACCU 2 and the contents of
ACCU 4 into ACCU 3. If you program the LEAVE instruction directly in front of a shift or rotate
instruction, and combine the accumulators, then the leave instruction functions like an arithmetic
instruction. The contents of ACCU 1 and ACCU 4 remain unchanged.
INC: Increment ACCU 1-L-L
Format: INC <8-bit integer>
INC <8-bit integer> (increment ACCU 1-L-L) adds the 8-bit integer to the contents of ACCU 1-L-L
and stores the result in ACCU 1-L-L. ACCU 1-L-H, ACCU 1-H, and ACCU 2 remain unchanged.
The instruction is executed without regard to, and without affecting, the status bits.
Note
These instructions are not suitable for 16-bit or 32-bit math because no carry is made from the low
byte of the low word of accumulator 1 to the high byte of the low word of accumulator 1. For 16-bit
or 32-bit math, use the +I or +D. instruction, respectively.
DEC: Decrement ACCU 1-L-L
Format: DEC <8-bit integer>
DEC <8-bit integer> (decrement ACCU 1-L-L) subtracts the 8-bit integer from the contents of
ACCU 1-L-L and stores the result in ACCU 1-L-L. ACCU 1-L-H, ACCU 1-H, and ACCU 2 remain
unchanged. The instruction is executed without regard to, and without affecting, the status bits.
Note
These instructions are not suitable for 16-bit or 32-bit math because no carry is made from the low
byte of the low word of accumulator 1 to the high byte of the low word of accumulator 1. For 16-bit
or 32-bit math, use the +I or +D. instruction, respectively.
+AR1: Add ACCU 1 to Address Register 1
Format: +AR1
+AR1 (add to AR1) adds an offset specified either in the statement or in ACCU 1-L to the contents
of AR1. The integer (16 bit) is initially expanded to 24 bits with its correct sign and then added to
the least significant 24 bits of AR1 (part of the relative address in AR1). The part of the area ID in
AR1 (bits 24, 25, and 26) remains unchanged. The instruction is executed without regard to, and
without affecting, the status bits.
+AR1: The integer (16 bit) to be added to the contents of AR1 is specified by the value in ACCU 1-
L. Values from -32768 to +32767 are permissible.
+AR1 <P#Byte.Bit>: The offset to be added is specified by the <P#Byte.Bit> address.
+AR2: Add ACCU 1 to Address Register 2
Format: +AR2
+AR2 (add to AR2) adds an offset specified either in the instructionor in ACCU 1-L to the contents
of AR. The integer (16 bit) is initially expanded to 2 bits with its correct sign and then added to the
least significant 24 bits of AR2 (part of the relative address in AR2). The part of the area ID in AR2
(bits 24, 25, and 26) remains unchanged. The instruction is executed without regard to, and without
affecting, the status bits.
+AR2: The integer (16 bit) to be added to the contents of AR2 is specified by the value in ACCU 1-
L. Values from -32768 to +32767 are permissible.
+AR2 <P#Byte.Bit>: The offset to be added is specified by the <P#Byte.Bit> address.
BLD: Program Display Instruction (Null)
Format: BLD <number>
BLD <number> (program display instruction; null instruction) executes no function and does not
affect the status bits. The instruction is used for the programming device (PG) for graphic display. It
is created automatically when a Ladder or FBD program is displayed in STL. The address
<number> specifies the BLD instruction and is generated by the programming device.
Format: NOP 0
NOP 0 (Instruction NOP with address "0") executes no function and does not affect the status bits.
The instruction code contains a bit pattern with 16 zeros. The instruction is of interest only to the
programming device (PG) when a program is displayed.
Format: NOP 1
NOP 1 (Instruction NOP with address "1") executes no function and does not affect the status bits.
The instruction code contains a bit pattern with 16 ones. The instruction is of interest only to the
programming device (PG) when a program is displayed.