![background image](http://html1.mh-extra.com/html/omron/nx-sl-series/nx-sl-series_instruction-and-reference-manual_742411092.webp)
2 Standard Functions
2 - 58
NX-series Safety Control Unit Instructions Reference Manual (Z931)
SUB
This function subtracts integers or durations.
If you omit an input or output parameter, a building error will occur.
An error will not occur if the output terminal is not used or if it is connected to an input terminal on the
next instruction.
This function subtracts subtrahend
In2
from minuend
In1
and outputs the result to output value
Out
.
An overflow occurs if the difference between
In1
and
In2
exceeds the valid range of the data type of the
subtraction result.
If an overflow occurs, the data types of
In1
and
In2
, the data type of the subtraction result, and the
value of the subtraction result will be as shown in the following table.
Instruction
Name
FB/FUN
Graphic expression
SUB
Subtraction
FUN
Variables
Name
I/O
Description
Valid range
Default
In1
Minuend
Input
Minuend
Depends on data type.
---
In2
Subtrahend
Input
Subtrahend
Depends on data type.
---
Out
Output value
Output
Output value
Depends on data type.
---
Boolean
Bit strings
Integers
Durations
BOOL
SAF
E
BOOL
BYTE
SAFEBYTE
WO
RD
SAFEWORD
DWORD
SAFEDWORD
IN
T
SAFEINT
DINT
SAFEDINT
TI
ME
SAFETIME
In1
OK
OK
OK
OK
OK
OK
In2
OK
OK
OK
OK
OK
OK
Out
OK
OK
OK
OK
OK
OK
Function
I/O data types
Value of subtraction results
Integers
Of the difference between
In1
and
In2
, the subtraction result will be the value that can be
expressed by the number of bits in the data type of the subtraction result.
*1*2
*1. For example, if the value of
In1
is INT#
−
5 and the value of In2 is INT#32767, the subtraction result will be
−
32772. If an INT variable is set for the output, the value of the subtraction result will be the value that can be
expressed with lower 16 bits of the difference (
−
32772), i.e., 32764. If a DINT variable is set for the output, the
subtraction results is DINT#
−
32772.
*2. If the result exceeds the valid range of DINT data, the result will be the value that can be expressed with the
lower 32 bits.
Durations
Of the difference between
In1
and
In2
, the subtraction result will be the value that can be
expressed by DWORD data.
*3
SUB
Summary of Contents for NX-SL series
Page 8: ...CONTENTS 6 NX series Safety Control Unit Instructions Reference Manual Z931 ...
Page 28: ...Sections in this Manual 26 NX series Safety Control Unit Instructions Reference Manual Z931 ...
Page 98: ...2 Standard Functions 2 64 NX series Safety Control Unit Instructions Reference Manual Z931 ...
Page 104: ...2 Standard Functions 2 70 NX series Safety Control Unit Instructions Reference Manual Z931 ...
Page 110: ...2 Standard Functions 2 76 NX series Safety Control Unit Instructions Reference Manual Z931 ...
Page 265: ...I 1 I NX series Safety Control Unit Instructions Reference Manual Z931 Index ...
Page 268: ...I 4 NX series Safety Control Unit Instructions Reference Manual Z931 Index ...
Page 269: ......