Topic: DMD0010

REFWRITE - Write Value Indirectly


The Write Value Indirectly (REFWRITE) instruction writes the specified value to the bit or numeric location in the Do-more controller (structure elements are not supported).

 

The numerical element is referenced by the appropriate block type from the following list, and the offset of the desired element within that block.

 

Parameters:

Note: Use the F9 key (Element Browser) or Down-Arrow key (Auto-Complete) at any time to see a complete list of the memory locations that are valid in the current field of the instruction.

 

Value - the Value to be written. This can be any constant value, any readable bit location, or any readable numeric location.

 

Reference Type - specifies the destination memory block number from the following table. Typically this will be a register location that will contain the desired memory block number.

 

Note: If the Reference Type is not a valid memory block number, $IndexError (ST129) will be ON.

The following table lists the pre-defined bit and numeric memory block numbers. Any user created blocks will be assigned a unique block number when they are created. These block numbers can be seen in the Memory Configuration page of the System Configuration dialog.

 

Reference Type

Memory Type

Description

1

ST

Status bit

2

DST

Status word

4

SDT

System Date/Time Structures

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

14

T

Timer Structure

15

CT

Counter Structure

16

SS

Short String Structure

17

SL

Long String Structure

18

UDT

User Date/Time Structure

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

28

LastMSG

System String Structure

29

LastERR

System String Structure

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

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

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

239

STREAMINBuff

User-defined Unsigned Byte

32

MyString

User-defined String Structure

 

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

 

Reference ID - designates the index within the selected memory block where the Value will be written. Typically this will be a register location that will contain the offset value. This can be any constant value from 0 to 65535 or any readable numeric location.
 

Note: If the Reference ID value exceeds the size of the block $IndexError (ST129) will be ON.

 


See Also:

 


Rung Example: