WRITE_REG
Original instructions
Function Description
Upon request, the WRITE_REG block writes a register area once (rising edge of the REQ input). It transfers data from the PLC via TCP/IP Ethernet to an addressed slave.
EN and ENO can be configured as additional parameters.
NOTE: About this function block:
  • When programming this function, you must be familiar with the routing procedures used by your network.
  • For technical reasons, this function block does not allow the use of ST and IL programming languages.
Symbol
Block representation:
Parameter Description
Description of parameters:
Parameter
Data Type
Meaning
REQ
BOOL
start write operation once
SLAVEREG
DINT
offset address of the first %MW word (4x register) in the slave to be written to
NO_REG
INT
number of registers to be written from slave
AddrFld
WordArr5
data structure transferring the TCP/IP address
REG_WRIT
WORD
first %MW word (4x register) of the source data area
DONE
BOOL
set to "1" for one scan after writing data
ERROR
BOOL
set to "1" for one scan in case of error
STATUS
WORD
error code
Elementary Description for WordArr5 with TCP/IP Ethernet
Elementary description for WordArr5 with TCP/IP Ethernet:
Element
Data Type
Meaning
WordArr5[1]
WORD
high value byte: Slot of the NOE module
low value byte: MBP on Ethernet Transporter (MET) mapping index
WordArr5[2]
WORD
byte 4 (MSB) of the 32-bit destination IP address
WordArr5[3]
WORD
byte 3 of the 32-bit destination IP address
WordArr5[4]
WORD
byte 2 of the 32-bit destination IP address
WordArr5[5]
WORD
byte 1 (LSB) of the 32-bit destination IP address
Function Mode of the WRITE_REG Module
CREAD_REG, CWRITE_REG, READ_REG, WRITE_REG, and MBP_MSTR function blocks use one data transaction path and require multiple cycles to complete an operation. The number of transaction paths available by module and by MAST cycle depends on the communication port used:
More communication function blocks may be programmed on the same communication port. However, a communication block exceeding the maximum number on that port is not serviced until one of the transaction paths is available. Then, the next block on the same port becomes active and begins using an available path.
If several WRITE_REG function blocks are used within an application, they must at least differ in the values of their NO_REG or REG_WRITE parameters.
NOTE: A TCP/IP communication between a Quantum PLC (NOE 771xx) and a Momentum PLC (all TCP/IP CPUs and all TCP/IP I/O modules) is possible only when one read or write job is carried out in every cycle. If several jobs are sent per PLC cycle, the communication stops without generating an error message in the status register of the function block.
The status signals DONE and ERROR report the function block state to the user program.
The entire routing information is contained in data structure WordArr5 of input AddrFld. The type of function block connected to this input and thus the contents of the data structure depend on the network used.
Please use:
NOTE: For experts: The WordArr5 data structure can also be used with constants.
REQ
A rising edge triggers the read transaction.
The REQ parameter can be specified as direct address, located variable or unlocated variable.
SLAVEREG
SLAVEREG is the start of the area in the addressed slave from which the source data is read. The source area always resides within the %MW word (4x register) area. SLAVEREG expects the source reference as offset within that area. In 4x registers, the leading 4 must be omitted. For example, 59 (contents of the variables or value of the literal) = 40059.
The parameter can be specified as direct address, located variable, unlocated variable, or literal.
NO_REG
Number of registers to be read from the addressed slave (1...100).
The parameter can be specified as direct address, located variable, unlocated variable, or literal.
REG_WRIT
The REG_WRIT word parameter addresses the first register in a series of NO_REG registers used as source data area.
The parameter must be entered as a direct address or located variable.
DONE
Transition to ON state for one program scan signifies data have been transferred.
The DONE parameter can be specified as direct address, located variable or unlocated variable.
ERROR
Transition to ON state for one program scan signifies detection of a new error.
The parameter can be specified as direct address, located variable or unlocated variable.
STATUS
Error code, see Runtime errors.
The parameter can be specified as direct address, located variable, or unlocated variable.