User manual

Toolbox 32 User Manual 1.47d www.cse-semaphore.com/mykingfisher
Page
74
Modulus
Calculates the modulus of Parameter 1 divided by Parameter 2 and returns the result in the Destination. The
modulus is the remainder after division and is represented by the percentage symbol (%). Eg. 10 % 3 = 1 (10
divided by 3 equals 3, with a remainder of 1). The Modulus block treats 16-bit registers as signed numbers (-
32767 to +32767, highest bit = sign).
Destination: 16-bit register (read/write, signed) or Long register (not Float).
Parameter 1, Parameter 2: 16-bit register (read/write, signed), Long register or constant (not Float).
Register types can be mixed in any order.
Caution! It is possible to exceed the range of the destination register and produce an undefined result.
Square Root
The square root of the Source (R2) is put in the Destination (R1).
Destination: Float register (#F).
Source: Float register (#F) or constant.
Multiply/Divide
Multiplies the Source with the Multiply By parameter, then divides the result with the Divide By parameter
and then puts the result in Destination. The Multiply/Divide block treats 16-bit registers as signed numbers (-
32767 to +32767, highest bit = sign).
Destination: 16-bit register (read/write, signed).
Source, Multiply By, Divide By: 16-bit register (read/write, signed) or constant. Note: a divide by zero
causes the destination to remain unchanged.
The Multiply/Divide block is very useful for scaling analog values into engineering units within the RTU. The
above example shows an analog input being converted to a number in the range 0-10,000 which could then
be displayed as 0-100.00% (Series 2 analog inputs are stored as a number in the range 0-32760 = 0-100%).
The Multiply/Divide block allows high accuracy when scaling a number as it uses a 32 bit total for its
calculations and then returns the lowest 16-bits as the result. If the result is greater than 65535 (16-bit limit),
the Multiply/Divide block returns a value of 8000 Hex (32767). Note: It is generally recommended to use
separate Multiply and Divide blocks with floating point parameters for scaling calculations as they can store a
much wider range of numbers, including fractional numbers, and are not likely to go out of range.