Upon request, the READ_REG block reads a register area once (rising edge of the REQ input). It reads data from an addressed slave via TCP/IP Ethernet.
EN and ENO can be projected 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 block parameters:
Parameter
|
Data Type
|
Meaning
|
REQ
|
BOOL
|
start read operation once
|
SLAVEREG
|
DINT
|
offset address of the first %MW word (4x register) in the slave to be read from
|
NO_REG
|
INT
|
number of registers to be read from slave
|
AddrFld
|
WordArr5
|
data structure describing the TCP/IP address
|
NDR
|
BOOL
|
set to 1 for one cycle after reading new data
|
ERROR
|
BOOL
|
set to 1 for one scan in case of error
|
STATUS
|
WORD
|
error code
|
REG_READ
|
WORD
|
first %MW word (4x register) for read values
|
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: Slot 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
|
Function Mode of READ_REG Blocks
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.
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 1 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 depends on the network used.
Please use:
NOTE: For experts: The WordArr5 data structure can be used with constants as well.
A rising edge triggers the read transaction.
The REQ parameter can be specified as direct address, located variable, unlocated variable, or Literal.
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.
Number of registers to be read from the addressed slave (1 ... 100).
The NO_REG parameter can be specified as direct address, located variable, unlocated variable, or literal.
Transition to ON state for one program cycle signifies receipt of new data ready to be processed.
The NDR parameter can be specified as direct address, located variable, or unlocated variable.
Transition to ON state for one program cycle signifies detection of a new error.
The ERROR parameter can be specified as direct address, located variable, or unlocated variable.
This word parameter addresses the first register in a series of NO_REG registers lying in series used as destination data area.
The REG_READ parameter must be entered as a direct address or located variable.
Error code, see Runtime errors.
The STATUS parameter can be specified as direct address, located variable or unlocated variable.