The CWRITE_REG block writes data to a register area continuously, transferring 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.
Block representation:
Description of parameters:
Parameter
|
Data Type
|
Meaning
|
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 to slave
|
REG_WRIT
|
WORD
|
first %MW word (4x register) of the source data area
|
AddrFld
|
WordArr5
|
data structure for transferring the TCI/IP address
|
STATUS
|
WORD
|
MBP_MSTR 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
|
low value byte: MBP on Ethernet Transporter (MET) mapping index
high value byte: slots of the NOE module
|
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
|
CWRITE_REG Block Function Mode
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:
-
Modbus Plus embedded port or NOM modules support up to 4 blocks at the same time.
-
TCP/IP Ethernet embedded port support up to 4 blocks at the same time.
-
TCP/IP Ethernet NOE, NOC, and 140 CRP 312 00 modules support up to 16 blocks at the same time.
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 CWRITE_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 only possible, when only 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 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.
NOTE: This function block puts a heavy load on the network. The network load must therefore be carefully monitored. If the network load is too high, the program logic should be reorganized to work with the WRITE_REG function block, which is a variant of this function block that does not operate in continuous mode but is command driven.
SLAVEREG is the start of the area in the addressed slave to which the source data are written. The destination area always resides within the %MW word (4x register) area. SLAVEREG expects the destination address 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 is the number of registers to be written to slave processor (1...100). The parameter can be specified as direct address, located variable, unlocated variable, or literal.
Error code, see Runtime errors.
The STATUS parameter can be specified as direct address, located variable or unlocated variable.
The REG_WRIT word parameter addresses the first register in a series of NO_REG Successive registers used as source data area.
The parameter must be entered as a direct address or located variable.