L9_SU16: Subtract 16-bit
(Original Document)
Naming
Name in LL984 Editor
Function Block Name
name of legacy 984 instruction
name in other tools and editors like:
  • Type Library Browser
  • Data Editor
  • Animation Tables
  • Search Results
Function Description
The L9_SU16 procedure performs signed or unsigned 16-bit subtraction of VALUE1 minus VALUE2, and then posts the RESULT in a memory word.
The subtraction operation begins when the input to the ENABLE pin is turned ON. The SIGNED input indicates whether the subtraction operation will be a signed (ON) or unsigned (OFF) operation.
L9_SU16 can activate 1 of 3 outputs. The state of the outputs indicates the relationship between VALUE1 and VALUE2. The GRT output turns ON if VALUE1 > VALUE2. The EQT output turns ON if VALUE1 = VALUE2. The LESSTH output turns ON if VALUE1 < VALUE2.
Formula
RESULT = VALUE1 − VALUE2
Representation
Parameters
Input Pin
Name
Data Type
Address Range
Meaning
Top
ENABLE
OFF to ON initiates the operation.
Bottom
SIGNED
BOOL
ON indicates a signed operation; OFF indicates an unsigned operation.
Node
Node Type
Name
Data Type
Address Range
Meaning
Top
IN
VALUE1
%IW, %MW
The minuend (the value subtracted from). Can be displayed as an integer constant, or can be stored in a variable located in a %IW input word, a %MW memory word or an unlocated word. Valid range: -32,768 to 32,767 (signed), 0 to 65,535 (unsigned).
Middle
IN
VALUE2
UINT
%IW, %MW
The subtrahend (the subtracted value). Can be displayed as an integer constant, or can be stored in a variable located in a %IW input word, a %MW memory word or an unlocated word. Valid range: -32,768 to 32,767 (signed). 0 to 65,535 (unsigned).
Bottom
IN/OUT
RESULT
UINT
%MW
The difference of 16-bit subtraction. Note that, if VALUE2 > VALUE1, the RESULT will be stored as a negative value in two´s complement form (65,536+RESULT). For example, if VALUE1 = 6 and VALUE2 = 7, RESULT =65,535 (which means -1) and LESSTH turns ON.
The variable tied to this node must be stored in a %MW memory word or an unlocated UINT word.
Output Pin
Name
Data Type
Address Range
Meaning
Top
GRT
BOOL
ON indicates the VALUE1 > VALUE2.
Middle
EQT
BOOL
ON indicates the VALUE1 = VALUE2.
Bottom
LESSTH
BOOL
ON indicates the VALUE1 < VALUE2.