Attribute 'TcLinkTo' / 'TcLinkToOSO'
The two pragmas can be used to assign variables directly to inputs and outputs of another process images.
Syntax:
{attribute 'TcLinkTo' := '<I/O point name>'}
The placeholder <I/O point name> in inverted commas must be replaced by the name of the input or output.
{attribute 'TcLinkToOSO' := '<x,y,z>'I/O point name'}
x: Bit-offset of the PLC variables
y: Number bits to be connected
z: Offset of the target variable, on which these bits are to be mapped
The placeholder <I/O point name> in inverted commas must be replaced by the name of the input or output.
Linking of allocated variables of a function block:
Allocated variables of a function block can also be linked with the help of the pragma. For function blocks, this doesn't take place at the declaration of the allocated variables, but at the declaration point of the function block instance. Further information on this can be found below in the section "Examples of the use of the attribute".
Representation of the linking method:
If a variable is manually linked with an input or output, the associated variable in the process image is given a white icon, as is the linked channel. If on the other hand the variable is linked via the attribute 'TcLinkTo' / 'TcLinkToOSO', then the associated icon is blue. No icon exists with a variable that is not linked.
PROGRAM MAIN
VAR
bVarIn1 AT%I* : BOOL; // linked manually
{attribute 'TcLinkTo' := 'TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 2 (EL1004)^Channel 2^Input'}
bVarIn2 AT%I* : BOOL; // linked via attribute
bVarIn3 AT%I* : BOOL; // not linked
bVarOut1 AT%Q* : BOOL; // linked manually
{attribute 'TcLinkTo' := 'TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 3 (EL2004)^Channel 2^Output'}
bVarOut2 AT%Q* : BOOL; // linked via attribute
bVarOut3 AT%Q* : BOOL; // not linked
END_VAR
Examples of the use of the attribute:
PROGRAM MAIN
VAR
nVar1 : INT;
{attribute 'TcLinkTo' := 'TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 5 (EL4132)^Channel1^Output'}
// Link when using the full path of an input or output
nVar2 AT%Q* : INT;
{attribute 'TcLinkTo' := '[1] := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 4 (EL2008)^Channel 4^Output;
[2] := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 4 (EL2008)^Channel 5^Output'}
aVar3 AT%Q* : ARRAY [1..2] OF BOOL;
{attribute 'TcLinkTo' := '.bIn := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 3 (EL1008)^Channel 2^Input;
.bOut := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 2 (EL2008)^Channel 2^Output'}
// Link when using function blocks (FB_Module with allocated input bIn and allocated output bOut)
fbVar4 : FB_Module;
{attribute 'TcLinkTo' := '[1].bIn := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 2 (EL1008)^Channel 4^Input;
[1].bOut := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 3 (EL2008)^Channel 4^Output;
[2].bIn := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 2 (EL1008)^Channel 5^Input;
[2].bOut := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 3 (EL2008)^Channel 5^Output'}
aModule : ARRAY[1..2] OF FB_Module;
{attribute 'TcLinkTo' := 'TIIB(2)^Channel 5^Output'}
// Linking with the keyboard shortcuts
bVar5 AT%Q* : BOOL;
{attribute 'TcLinkTo' := 'TIIB[TerminalXY]^Channel 5^Output'}
// TerminalXY is the name of the terminal shown in the IO tree
nVar6 AT%Q* : INT;
{attribute 'TcLinkToOSO' := '<1,2,3>TIIB(5)^Channel 2^Output'}
// Link when using Offset/Size/Offset
nVar7 AT%Q* : BYTE;
{attribute 'TcLinkToOSO' := '[1] := <1,2,3>TIIB(5)^Channel 2^Output;
[2] := <4,5,6>TIIB(5)^Channel 3^Output'}
aVar8 AT%Q* : ARRAY [1..2] OF WORD;
{attribute 'TcLinkTo' := '[0][0] := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 2 (EL2008)^InfoData^State;
[0][1] := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 3 (EL2008)^InfoData^State;
[0][2] := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 4 (EL2008)^InfoData^State;
[1][0] := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 5 (EL2008)^InfoData^State;
[1][1] := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 6 (EL2008)^InfoData^State;
[1][2] := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 7 (EL2008)^InfoData^State'}
aVar9 AT%Q* : ARRAY[0..1, 0..2] OF UINT;
(*************************************************************************************)
Available from TC3.1 Build 4026
(*************************************************************************************)
// ARRAY info on the left is "%d..%d" and on the right side "%d..#"
// Link info will be generate from 1 TO 4 (4 times) and from 3 TO 6 on channel side
{attribute 'TcLinkTo' := '[1..4] := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 2 (EL2008)^Channel 3..#^Output'}
bVar10 AT %Q* : ARRAY[1..4] OF BOOL;
{attribute 'TcLinkTo' := '[1..4] := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 4 (EL4014)^AO Outputs Channel 1..#^Analog output'}
bVar11 AT %Q* : ARRAY[1..4] OF INT;
// Also additional syntax for EtherCAT PLC structures to PLC mappings - see "PLC" tab on EtherCAT terminals:
// ARRAY info on the left is "%d..%d" and on the right side "%d..#" - channel index is added via "^^%d" and the value is 0-based
{attribute 'TcLinkTo' := '[1..4] := TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 5 (EL2819)^^ 0..#'}
bVar12 : ARRAY [1..16] OF MDP5001_280_700116F7;
END_VAR
Table of all available shortcuts:
Shortcut | To |
---|---|
TIIC | Node I/O configuration |
TIID | node I/O configuration^I/O devices or |
TIRC | Node real-time configuration |
TIRT | node real-time configuration^additional tasks or |
TIRS | node real-time configuration^real-time settings or |
TIPC | Node PLC configuration |
TINC | Node NC configuration |
TICC | Node CNC configuration |
TIAC | Node CAM configuration |
TING | Node axes |
TINT | Node tables |
TINS | Node SAF task |
TIIT(%d) | Terminal %d (only for KL bus) |
TIIB(%d) | Box %d |
TIIF(%d) | Device %d |
TIIT[%s] | Terminal with name %s (only for KL bus) |
TIIB[%s] | Box with name %s |
TIIF[%s] | Device with name %s |