ADDR_OFS(location, i)
Returns the address of the ith register after location. This function is intended only for use with the COPY function.
Parameters
Location(Address)
The address of the register location.
i(DINT)
The offset, in 32-bit registers, from the location.
Return Value
Returns the address of the ith register after the register location. This address cannot be used directly, but is intended to be passed into one of the COPY function’s parameters.
Remarks
The ADDR_OFS function can be used to calculate an address from a base address and an offset when using the COPY function. For example, if the first tag in the block is called MyFirstTag, then the address of a tag located 4 registers after MyFirstTag can be calculated with:
ADDR_OFS(MyFirstTag, 4)
The ADDR_OF function is especially useful when copying from large blocks of data that are not declared as arrays because it lends itself well to looping and calculating addresses during each loop. However, best programming practice is usually to set up the data in arrays, and use the COPY function on those arrays, which makes the ADDR_OFS unnecessary.
The Address parameter may not be a local variable. Therefore, the ADDR_OFS function may not be used in User Functions.
Examples
See the COPY function for an example.
See Also
Copyright © 2024 Delta Computer Systems, Inc. dba Delta Motion