Programmer (HHP) User guide

Chapter 10
Using Math Instructions
10โ€“8
Use the MUL instruction to multiply one value (source A) by another
(source B) and place the result in the destination.
Source A and B can either be a word address or a constant, however both
sources cannot be a constant. The destination must be a word address.
If the result is larger than +32,767 or smaller than โ€“32,767 (16-bits), the
32-bit result is placed in the math register.
Updates to Arithmetic Status Bits
With this Bit: The Controller:
S0/0
Carry (C)
always resets.
S0/1 Overflow (V)
sets if overflow is detected at destination; otherwise resets.
On overflow, the minor error flag is also set. The value
โ€“32,768 or 32,767 is placed in the destination. If S2/14
(math overflow selection bit) is set, then the unsigned,
truncated overflow remains in the destination.
S0/2 Zero (Z) sets if result is zero; otherwise resets.
S0/3 Sign (S) sets if result is negative; otherwise resets.
Entering the Instruction
You enter the instruction from within the program monitor functional area.
0 0 0 M U L S R C A
N 4 0
0 0 0 M U L S R C B
6 0
0 0 0 M U L D E S T
N 6 0
Changes to the Math Register
The math register contains the 32-bit signed integer result of the multiply
operation. This result is valid at overflow.
MUL
MULTIPLY
Source A N7:4
0
Source B 60
Dest N7:6
0
Execution Times (ยต
sec) when:
True False
57.96 6.78
Ladder representation:
Multipl
y
(
M
U
L
)
2
L
8
FUN
ENT
To enter the function code, press: