Description
The "VARIANT" data type is used to transfer data areas. This data type is a pointer that points to the variables of different data and parameter types. More information on the "VARIANT" pointer is is available in the STEP 7 V10.5 Online Help under
- "Valid data types in the code block interfaces"
- "VARIANT"
The table below gives instructions for the communication that includes a parameter of the "VARIANT" data type.
|
Blocks with a parameter of the "VARIANT" data type
|
| Block |
Function |
Parameter of the
"VARIANT" data type |
| TSEND_C |
Send data via Ethernet |
DATA1) |
| TRCV_C |
Receive data via Ethernet |
DATA1) |
| TSEND |
Send data via an existing communication connection |
DATA1) |
| TRCV |
Receive data via an existing communication connection |
DATA1) |
| SEND_PTP |
Send point-to-point message |
BUFFER2) |
| RCV_PTP |
Receive point-to-point message |
BUFFER2) |
Table 01
1) Indicates the send or receive area that contains the address and length of the data to be sent or received.
2) Indicates the initial address of the send or receive buffer.
The table below contains a few examples of how to assign a block parameter of the "VARIANT" data type with the ANY pointer.
| No. |
Examples for parameterizing with the ANY pointer |
| 1 |
The "DATA" parameter of the extended instruction "TSEND_C" is parameterized with the input area from E1.0 to E8.7 (8 bytes).

Fig. 01
|
| 2 |
The "DATA" parameter of the extended instruction "TSEND_C" is parameterized with the marker area from M20.0 to M27.7 (8 bytes).

Fig. 02
|
| 3 |
The "DATA" parameter of the extended instruction "TSEND_C" is parameterized with a data area of bytes of data block DB22.
If you want to parameterize the above-mentioned parameters with the data block variables and the ANY pointers, you must disable symbolic addressability when creating a data block.
- Open the "Add new block" dialog by double-clicking on the "Add New Block" function in the "Program Blocks" folder.
- Click on the "Data block (DB)" button to create a data block.
- Disable the "Symbolic access only" option.
- Confirm with OK.

Fig. 03
Now you can parameterize the "DATA" parameter of the "VARIANT" data type with the ANY pointer and the DB variables for the required data area.

Fig. 04
|
Table 02
Note
You can also disable the "Symbolic access only" option under "Options > Settings > PLC Programming" in the "Presetting for new blocks" group. Then all new blocks are created with this presetting (as in Fig. 03). This presetting does not affect instance DBs and blocks already present.
Creation environment
The pictures and downloads in this FAQ were created with STEP 7 Basic version V10.5.