L9_AD16: Add 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_AD16 procedure performs signed or unsigned 16-bit addition on VALUE1 and VALUE2, and posts the result of the addition into the variable tied to the SUM.
L9_AD16 has 2 control inputs. The addition operation begins when the input to the ENABLE pin is turned ON. The SIGNED input indicates whether the addition operation will be a signed (ON) or unsigned (OFF) operation.
L9_AD16 can activate 1 of 2 outputs. The OUT output turns ON upon the successful completion of the operation. The OVERFL output turns ON if there is an overflow in the SUM. In an unsigned operation, an overflow is a value greater than 65,535. In a signed operation, an overflow is a value greater than +32,767 or less than -32,768.
Formula
SUM = 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 first value to be added. 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 second value to be added. 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
SUM
UINT
%MW
The sum of 16-bit addition or, if the OVERFL output is ON, the amount by which the sum exceeds a word’s maximum value for the unsigned, positive signed or negative signed operation. The variable tied to this node can be stored in a %MW memory word or an unlocated UINT word.
Output Pin
Name
Data Type
Address Range
Meaning
Top
OUT
BOOL
ON indicates the 16-bit addition operation succeeded. (Echoes the status of the ENABLE input).
Bottom
OVERFL
BOOL
ON indicates a sum overflow. L9_AD16 can accumulate sums that are greater than the SUM value it can display. When the OVERFL output is ON, the true sum equals the displayed SUM value plus one of the following values:
  • 65,536 for unsigned addition
  • +32,767 for positive signed addition
  • -32,768 for negative signed addition.