BECKHOFF Q&A :How do I use instructions to establish variable linking (attribute-based variable linking)?

 How do I use instructions to establish variable linking (attribute-based variable linking)?

Answer:
The 'TcLinkTo' or 'TcLinkToOSO' attribute instructions can be used to establish a link between a variable and a hardware channel.

The syntax for writing this is: {attribute 'TcLinkTo' := '<I/O point name>'}

As with other attribute instructions, this only applies to the variable declared on the next line and the variable must be declared as an input or output variable.

For specific formatting and examples, please refer to the relevant documentation or case studies regarding info links.

https://infosys.beckhoff.com/content/1033/tc3_plc_intro/3107974923.html?id=3796864311828577666

For structures, arrays, and function block pins, the same instruction can be used to specifically link variables to individual elements and pins, as shown in the figure below.


After building, the corresponding variable links will be generated based on the instructions. Unlike conventional manual linking methods, this type of linking is distinguished by a blue subscript on the icon.



How can I quickly obtain the I/O point name?

You can manually copy the Full Name from the Variable tab in the hardware channel, as shown in the figure below. Additionally, you can modify the name according to a specific pattern, such as quickly changing the channel number, for example.





Absolutely, after copying the name, don't forget to enclose it in a pair of single quotes (') according to the required format. 

Like my work? Consider a donation! 👇