Sei sulla pagina 1di 3

Read Data from a Remote CPU with SFB/FB 14 "GET" Page 1 of 3

Read Data from a Remote CPU with SFB/FB 14 "GET"


Description
You can read data from a remote CPU with SFB/FB 14 "GET".
S7-300: The data is read on a rising edge at REQ. The parameters ID, ADDR_1 and RD_1 are transferred on
each rising edge at REQ. After a job has been completed, you can assign new values to the ID, ADDR_1 and
RD_1 parameters.
S7-400: The SFB is started with a rising edge at control input REQ. The relevant pointers to the areas to be
read out (ADDR_i) are then sent to the partner CPU.
The remote partner returns the data.
The received data are copied to the configured receive areas (RD_i) at the next SFB/FB call.
Ensure that the areas defined with the parameters ADDR_i and RD_i match in terms of length and data type.
The completion of the job is indicated by a 1 at the status parameter NDR.
The read job can only be activated again after the previous job has been completed.
The remote CPU can be in the operating state RUN or STOP.
Errors and warnings are output via ERROR and STATUS if access problems occurred while the data were
being read or if the data type check results in an error.

Parameter Declaration Data Type Memory Area Description


REQ INPUT BOOL I, Q, M, D, L Control parameter request, activates the
data exchange at a rising edge.

ID INPUT WORD IM, D, constant Addressing parameter ID, refer to Common


Parameters of the SFBs/FBs and SFC/FC
for the S7 communication

NDR OUTPUT BOOL I, Q, M, D, L NDR status parameter:


0: Job not started or still active.
1: Job successfully completed.

ERROR OUTPUT BOOL I, Q, M, D, L ERROR and STATUS state parameters,


STATUS OUTPUT WORD I, Q, M, D, L error display:
ERROR=0
STATUS has the value:
0000H: neither warning nor error
<> 0000H: Warning, STATUS supplies
detailed information.
ERROR=1
An error occurred. STATUS gives you
detailed information on the type of error.
S7-300: IN_OUT ANY S7-300: Pointers to the areas on the partner CPU
ADDR_1 M, D that are to be read.
Note:
S7-400: S7-400: If the ANY pointer accesses a DB, the DB
ADDR_i I, Q, M, D, T, C must always be specified (for example: P#
DB10.DBX5.0 Byte 10)
(1 i 4)
S7-300: IN_OUT ANY S7-300: Pointers to the areas on the local CPU in
RD_1 M, D which the read data are entered.
Only the following data types are
S7-400: S7-400: permissible:
RD_i I, Q, M, D, T, C BOOL (not allowed: Bit field), BYTE, CHAR,

mk:@MSITStore:C:\Program%20Files%20(x86)\Siemens\Step7\s7bin\s7rsfbcb.chm::/SF... 11/21/2019
Read Data from a Remote CPU with SFB/FB 14 "GET" Page 2 of 3

(1 i 4) WORD, INT, DWORD, DINT, REAL,


COUNTER, TIMER.
Note:
If the ANY pointer accesses a DB, the DB
must always be specified (for example: P#
DB10.DBX5.0 Byte 10).

Error Information
The following table contains all the error information specific to SFB/FB 14 that can be output with the
parameters ERROR and STATUS.

ERROR STATUS Explanation


(Decimal)
0 11 Warning:
New job cannot take effect since previous job is not yet completed.
The job is now being processed in a priority class having lower priority.
0 25 Communication has started. The job is being processed.
1 1 Communications problems, for example:
Connection description not loaded (local or remote)
Connection interrupted (for example: cable, CPU off, CP in STOP mode)
Connection to partner not yet established
FB cannot be run on an S7-400-CPU
Also for S7-300:
Maximum number to parallel jobs/instances exceeded
1 2 Negative acknowledgement from the partner device. The function cannot be
executed.
1 4 Errors in the receive area pointers RD_i involving the data length or the data
type.
1 8 Access error on the partner CPU.
1 10 Access to the local user memory not possible (for example, access to a
deleted DB)
1 12 When the SFB was called,
An instance DB was specified that does not belong to SFB 14.
No instance DB was specified, but rather a shared DB.
No instance DB found (loading a new instance DB from the PG).
1 20 S7-400: Not enough work memory available. If there is still enough total
work memory available, then the solution is to compress the work memory.
H system: a first call of SFB is not possible during an update since the
communication buffer in the work memory is being created. Measures that
change the work memory are not possible during an update.
S7-300:
Maximum number of parallel jobs/instances exceeded

The instances were overloaded at CPU-RUN (STOP-RUN transition of


the CPU or CP required.)

Possible when first called


1 27 There is no function code in the CPU for this block (only for S7-300)

Data Consistency
The data are received in a consistent state if the following point is observed:

mk:@MSITStore:C:\Program%20Files%20(x86)\Siemens\Step7\s7bin\s7rsfbcb.chm::/SF... 11/21/2019
Read Data from a Remote CPU with SFB/FB 14 "GET" Page 3 of 3

Evaluate the part of the receive area RD_i currently being used completely before initiating another job.

mk:@MSITStore:C:\Program%20Files%20(x86)\Siemens\Step7\s7bin\s7rsfbcb.chm::/SF... 11/21/2019

Potrebbero piacerti anche