Technical data

Table Of Contents
SFCs/SFBs for Transferring Data Records
System Software for S7-300/400 System and Standard Functions - Volume 1/2
A5E00709327-01
7-13
7.8 Reading a Data Record with SFC 59 "RD_REC"
Description
With SFC 59 "RD_REC" (read record), you read the data record with the number
RECNUM from the addressed module. You start the read job by calling SFC 59
and assigning the value 1 to the input parameter REQ. If the read job could be
executed immediately, the SFC returns the value 0 in the BUSY output parameter.
If BUSY has the value 1, the read job is not yet completed. The data record read is
entered in the destination area indicated by the RECORD parameter providing the
data transfer was free of errors.
Note
When you fetch a data record with a number > 1 from an FM or a CP you have
purchased prior to February 1997 (below referred to as "old modules"), SFC 59
responds differently than in new modules. This special situation is covered in the
section "Using old S7-300 FMs and CPs with DR Numbers >1”.
Note
If a DPV1 slave is configured using a GSD file (GSD as of Rev. 3) and the DP
interface of the DP master is set to "
S7 compatible
", then data records must not be
read from the I/O modules in the user program with SFC 59. The reason is that in
this case the DP master addresses the incorrect slot (configured slot +3).
Remedy: Set the interface for the DP master to "DPV1".
Parameter Declaration Data Type Memory Area Description
REQ INPUT BOOL I, Q, M, D, L,
constant
REQ = 1: Read request
IOID INPUT BYTE I, Q, M, D, L,
constant
ID of the address area:
B#16#54 = Peripheral input (PI)
B#16#55 = Peripheral output (PQ)
If the module is a mixed module, specify the
area ID of the lowest address. If the
addresses are the same, specify B#16#54.
LADDR INPUT WORD I, Q, M, D, L,
constant
Logical address of the module. With mixed
modules, specify the lower of the two
addresses.
RECNUM INPUT BYTE I, Q, M, D, L,
constant
Data record number (permitted values 0 to
240)
RET_VAL OUTPUT INT I, Q, M, D, L If an error occurs while the function is active,
the return value contains an error code. The
length of the data record actually transferred
in bytes (possible values: +1 to +240) is also
entered if the destination area is larger than
the transferred data record and if no error
occurred in the transfer.
BUSY OUTPUT BOOL I, Q, M, D, L BUSY = 1: Reading is not yet completed.