User manual

Toolbox 32 User Manual 1.47d www.cse-semaphore.com/mykingfisher
Page
72
Ladder Logic - Maths
16-bit Register Range
0-65535 (unsigned) or -32768 to +32767 (signed). Values overflowing the storage limit are counted from
zero again. Eg. 65535 + 1 is stored as 0, 65535 + 2 is stored as 1. Values less than zero are counted
backwards from 0. Eg. -1 is stored as 65535, -2 is stored as 65534. All Kingfisher addresses (ie. #R, #AI,
#AO, #DI, #DO, #NR, #NA, #ND, #Y, #T) are 16-bit registers except for Floating point (#F) and Long (#L)
registers which are 32-bit registers and provide a greater numerical range.
Mixing Register Types
The Add, Subtract, Multiply and Divide maths blocks allow the 3 register types (16-bit, Float or Long) to be
used in any combination. If the destination register is a different type to either parameter, a type conversion
is used to obtain the result.
Increment
Increments the parameter by one. Eg. R1=R1+1. As used in the topic Example - Flow Totalisation.
Parameter: 16-bit register (read/write) or Long register (not Float)
Decrement
Decrements the parameter by one. Eg. R1=R1-1.
Parameter: 16-bit register (read/write) or Long register (not Float).
Add
Parameter 2 (R3) is added to Parameter 1 (R2) and the result is put in the Destination (R1). As used in the
topic Example - Flow Totalisation.
Destination: 16-bit register (read/write), Long or Float register.
Parameter 1, Parameter 2: 16-bit register (read/write), Long, Float or constant. 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.