Topic: DMD0113

REF - Read Value Indirectly


This instruction can only be used in the Expression parameter of the Calculate Expression (MATH) instruction.

 

The Read Value Indirectly (REF) math function returns the value of the specified bit or numerical element. The element is referenced by the appropriate block number from the following chart, and the offset of the desired element within that block.

 

The parameter list of this function takes two expression parameters separated by a comma between the bounding parentheses. Any expression parameter can be a constant value, a bit or numeric memory location, an arithmetic expression, and/or mathematical function or other expressions up to a maximum of 1024 characters. Expressions can be nested, so use of parentheses is recommended to ensure proper evaluation order.

 

The first parameter specifies the source memory block number from the list of memory block numbers shown in the Memory Configuration tab of the System Configuration dialog. This must reference a Bit or Numeric data block, structure data blocks are not valid.

 

Note: If the first parameter (Block Number) is not a valid memory block number, $IndexError (ST129) will be ON.
 

The second parameter designates the offset within the selected memory block. This can be any constant value from 0 to 65535 or any readable numeric location.

Note:
If the second parameter (Offset) exceeds the size of the selected data block, $IndexError (ST129) will be ON.

 

Memory Block Numbers:

Note: the complete list of memory block numbers can be seen on the Memory Configuration tab of the System Configuration dialog.

 

Memory Block Number

Block Name

Description

1

ST

Status bit

2

DST

Status word

5

X

Input bit

6

Y

Output bit

7

WX

Word input

8

WY

Word output

9

C

Control bit

10

V

Word variable

11

N

Unsigned Word

12

D

Double word variable

13

R

Real variable

19

PL

PeerLink Words

20

DLX

DirectLOGIC inputs

21

DLY

DirectLOGIC outputs

22

DLC

DirectLOGIC control bit

23

DLV

DirectLOGIC word variable

24

MI

Modbus inputs

25

MC

Modbus coils

26

MIR

Modbus input registers

27

MHR

Modbus holding Registers

--------------------

-----------------------------------------

-----------------------------------------------------------

239

STREAMINBuff

User-defined Unsigned Byte

 


See Also:

 


Related Topics:

 


Rung Example: