L9_SUB: Subtraction
(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_SUB procedure performs subtraction of unsigned VALUE1 minus unsigned VALUE2, and then posts the RESULT in a memory word.
The subtraction operation begins when the input to the ENABLE pin is turned ON.
L9_SUB 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.
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: 0 to 65,535.
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: 0 to 65,535.
Bottom
IN/OUT
RESULT
UINT
%MW
The difference of 16-bit subtraction. Note that, if VALUE2 > VALUE1, the RESULT will be stored as a positive value For example, if VALUE1 = 6 and VALUE2 = 7, RESULT = 1 and LESSTH turns ON.
The variable tied to this pin 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.