101BExtended instructions
8.3 Distributed I/O (PROFINET, PROFIBUS, or AS-i)
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
269
8.3.4
DPRD_DAT and DPWR_DAT
You can use the DPRD_DAT (Read consistent data) and DPWR_DAT (Write consistent
data) instructions with PROFINET and PROFIBUS.
Table 8- 79 DPRD_DAT and DPWR_DAT instructions
LAD / FBD
SCL
Description
ret_val := DPRD_DAT(
laddr:=_word_in_,
record=>_variant_out_);
Use the DPRD_DAT instruction to read the consistent
data of a DP standard slave/PROFINET IO device. If no
errors occur during the data transfer, the data read is
entered into the target area set up by the RECORD
parameter. The target area must have the same length as
you configured with STEP 7 for the selected module.
When you call the DPRD_DAT instruction, you can only
access the data of one module / DP identification under
the configured start address.
ret_val := DPWR_DAT(
laddr:=_word_in_,
record:=_variant_in_);
Use the DPWR_DAT instruction to transfer the data in
RECORD consistently to the addressed DP standard
slave/PROFINET IO device. The source area must have
the same length as you configured with STEP 7 for the
selected module.
The CPU supports up to 64 bytes of consistent data. For consistent data areas greater than
64 bytes, the DPRD_DAT and DPWR_DAT instructions must be used. If required, these
instructions can be used for data areas of 1 byte or greater. If access is rejected, error code
W#16#8090 will result.
Note
If you are using the DPRD_DAT and DPWR_DAT instructions with consistent data, you must
remove this consistent data from the process-image automatic update. Refer to "PLC
concepts: Execution of the user program" (Page 61) for more information.
Table 8- 80 Data types for the parameters
Parameter and type
Data type
Description
LADDR
IN
HW_IO (Word)
Configured start address from the "I" area of the module from which
the data will be read (DPRD_DAT)
Configured start address from the process image output area of the
module to which the data will be written (DPWR_DAT)
Addresses have to be entered in hexadecimal format (for example, an
input or output address of 100 means: LADDR:=W#16#64).
RECORD
OUT
Variant
Destination area for the user data that were read (DPRD_DAT) or source
area for the user data to be written (DPWR_DAT). This must be exactly
as large as you configured for the selected module with STEP 7. Only the
data type Byte is permitted.
RET_VAL
OUT
Int
If an error occurs while the function is active, the return value contains an
error code.