What should you watch out for if you transfer variables with the data type "REAL" when calling the communication blocks FC5/50 "AG_SEND/AG_LSEND" and FC6/60 "AG_RCV/AG_LRCV"?
Make sure when calling the communication blocks FC5/50 "AG SEND/AG_LSEND" and FC6/60 "AG_RCV/AG_LRCV" that only the data type BYTE is in the ANY pointer for the input parameters SEND and RECV.
If, for example, you wish to transfer a variable of the data type "REAL" with FC5 "AG_SEND" and declare the ANY pointer at the "SEND" input parameter as follows:
- P#DB1.DBX0.0 Byte 4,
then this ANY pointer is converted by STEP 7 into its symbolic address, i.e. the ANY pointer points to the data type REAL in the data block (DB) specified. The data types BYTE, WORD and DWORD are permitted for the ANY pointer at the "SEND" input parameter. However, the data type REAL is used in this example, i.e. the data to be transferred is not interpreted correctly. The ERROR output parameter of FC5 is set.
Fig. 01: Symbolic name of the ANY pointer
Increase the value of the ANY pointer at the "SEND" input parameter by at least 1 byte to prevent the symbolic display of the ANY pointer.
The declaration now looks like this:
- P#DB1.DBX0.0 Byte 5
Fig. 02: ANY pointer with a length greater than the value to be sent