User manual

Toolbox 32 User Manual 1.47d www.cse-semaphore.com/mykingfisher
Page
58
Indirect Addressing
When addressing a register, the register number is usually hardcoded in the address eg. #R1. The register
number can also be specified indirectly by putting the register number in another register (the pointer
register) and then using indirect addressing. If the pointer register contains a value that will point out of range
(eg. 0 or 3000), the indirect register address will return an incorrect value. Indirect addressing is extremely
useful for reducing the amount of ladder logic required to perform a repetitious task (eg. calculating the
average rainfall per minute for the last 60 minutes).
Indirect Address
Description
Example
#R[Rx]
#F[Rx]
#L[Rx]
Indirect local, float or long
register
#R1 = 2
#R2 = 1000
#R[R1] = #R2 = 1000
#Rx.[Ra*] Indirect local bit. Local
register Ra is used to point
to a bit of register Rx
#R1 = 16
#R2.16 = 1 = ON
#R2.[R1] = #R2.16 = 1 (ON)
#R[Rx].[Ra*] Indirect local register and
bit
#R1 = 3
#R2 = 16
#R3 = 8000 Hex (Bit 16 ON)
#R[R1].[R2] = #R3.16 = 1 (ON)
#NR[Ra*].n
(n=1 to 2048)
Indirect network RTU #R1 = 2
#NR2.1 = 1000
#NR[R1].1 = #NR2.1 = 1000
#NR[Ra*].[Rx] Indirect network RTU and
register
#R1 = 2
#R2 = 5
#NR2.5 = 1000
#NR[R1].[R2] = #NR2.5 = 1000
#NR[Ra*].[Rx].[Rb*] Indirect network RTU,
register and bit
#R1 = 2
#R2 = 1
#R3 = 16
#NR2.1.16 = 1 = ON
#NR[R1].[R2].[R3] = #NR2.1.16 = 1 = ON
#R[Rx+nnn]
or #R[Rx-nnn]
(nnn = -128 to +127)
Indirect local register with
offset. nnn is an offset that
is added or subtracted to
the pointer register Rx
Useful when a block of local registers is used to store a
number of values. One register would be used as a
pointer to the first register in the array, then any of the
other registers in the array could be accessed from the
same pointer register
* Ra, Rb and Rc must be in the range of R1 to R256 due to memory limitations of indirect addressing.
Rx can be any local register (R1 to R2048)
Examples
Please see the topics Example - Indirect Addressing or Example - Time Based Rolling Averages.