What points do you need to remember when calling communication blocks FC5/50 and FC6/60 in the STEP 7 user program of the CPU?
In order to communicate via the SEND/RECEIVE interface of the S7-300 and S7-400 Industrial Ethernet CPs, the following communication blocks are called in the STEP 7 user program of the CPU.
- FC5/6 "AG_SEND / AG_RECV" in the S7-300 CPU for data transfer of up to 8192 bytes and in the S7-400 CPU for data transfer of up to 240 bytes.
- FC50/60 "AG_LSEND / AG_LRECV" in the S7-400 CPU for data transfer of up to 8192 bytes. These communication blocks are not available for the S7-300 CPU.
The communication blocks mentioned above are in the SIMATIC_NET_CP library.
The following points are to be noted when calling these communication blocks:
- In the S7-300 and S7 400 CPUs, the communication block FC5/50 "AG_SEND/AG_LSEND at the input parameter ACT is started with "High" pulse. Then the block must run through with "Low" at the ACT input until the asynchronous communication job has been completed with the output parameter DONE or ERROR.
- In the S7-400, the communication block FC50 "AG_LSEND signalizes with the output parameter ERROR=True and the STATUS=0x7000 that the communication job has been called with ACT=0. In this case the communication block FC50 "AG_LSEND" is called again without a new send job being started with a "High" pulse at the input parameter ACT.
More information on STATUS=0x7000 is available in Entry ID: 17877734.
- As long as a connection has not been set up or has been interrupted, this is reported on the block with output parameter ERROR=1 and STATUS=0x8183 or 0x8304. Then there must be a delay of approx 1 second before the block is called again!
- The output parameter ERROR=True and the STATUS=0x80C3 "The resources (memory) of the CPU are temporarily occupied." indicates that the resources of the S7 CPU are temporarily occupied. These resources depend on the CPU used. In your STEP7 project you can check the maximum number and the number of reserved connection resources in the Properties window of the CPU, in the "Communication" tab.
In the device manual of the Industrial Ethernet CPs, chapter 2 "Requirements for Use", is information on which CPUs support the relevant Industrial Ethernet CP.
In the following entries are sample programs for calling the communication blocks.
- FC5/6 "AG_SEND/AG_RECV" in the S7-300 CPU Entry ID: 17853532)
- FC5/60 "AG_SEND/AG_RECV" in the S7-400 CPU Entry ID: 18513371)