Data Transfer Between Axes

There are 2 categories of data transfer operations between axes:

1.Read data from a remote axis. A variable or a memory location from the remote axis is saved into a local variable
2.Write data to a remote axis or group of axes. A variable or a memory location of a remote axis or group of axes is written with the value of a local variable

In a read data from a remote axis operation:

The source is placed on a remote axis and can be:
A 16-bit TML data: TML register, parameter, variable or user variable
A memory location indicated through a pointer variable
The destination is placed on the local axis and can be:
A 16-bit TML data: TML register, parameter or user variable

Programming Examples

1) Source: remote 16-bit TML data, Destination: local 16-bit TML data.

       local_var = [2]remote_var;        // set local_var with value of remote_var from axis 2

Remark: If remote_var is a user variable, it has to be declared in the local axis too. Moreover, for correct operation, remote_var must have the same address in both axes, which means that it must be declared on each axis on the same position. Typically, when working with data transfers between axes, it is advisable to establish a block of user variables that may be the source, destination or pointer of data transfers, and to declare these data on all the axes as the first user variables. This way you can be sure that these variables have the same address on all the axes.  

2) Source: remote memory location pointed by a remote pointer variable, Destination: 16-bit TML data. The remote memory location can be of 3 types: RAM memory for TML data (dm), RAM memory for TML programs (pm), EEPROM SPI-connected memory for TML programs (spi). If the pointer variable is followed by a + sign, after the assignment, the pointer variable is incremented by 1 if the destination is a 16-bit integer or by 2 if the destination is a 32-bit long or fixed

local_var = [2](p_var),spi;        // local_var = value of EEPROM program memory

// location from axis 2, pointed by p_var from axis 2

long_var = [3](p_var+),dm;        // local long_var = value of RAM data memory

// locations from axis 3, pointed by p_var from axis 3

// p_var is incremented by 2

int_var = [4](p_var+),pm;        // local int_var = value of RAM program memory

// location from axis 4, pointed by p_var from axis 4;

// p_var is incremented by 1

Remark: The TML instructions for data transfers between axes use a short address format for the remote source when this is a TML data. The short address format requires a source address between 0x200 and 0x3FF or between 0x800 and 0x9FF. This restriction is respected now by all the predefined or user-defined TML data, hence you can use the above assignment instructions without checking the variables addresses.

However, considering possible future developments, the TML also includes data transfers using a full address format where the source address can be any 16-bit value. The following command supports full addressing:

       local_var = [2]remote_var,dm;                // set local_var with value of remote_var

// from axis 2 using extended addressing

In a write data to a remote axis or group of axes operation:

The source is placed on the local drive and can be:
A 16-bit TML data: TML register, parameter, variable or user variable
The destination is placed on the remote axis or group of axes and can be:
A 16-bit TML data: TML register, parameter or user variable
A memory location indicated through a pointer variable

Programming Examples

1) Source: local 16-bit TML data, Destination: remote 16-bit TML data.

[2]remote_var = local_var;    // set remote_var from axis 2 with local_var value

[G2]remote_var = local_var; // set remote_var from group 2 with local_var value

[B]remote_var = local_var; // set remote_var from all axes with local_var value

       // broadcast with group ID = 0 -> got by everyone

2) Source: 16-bit TML data, Destination: remote memory location pointed by a remote pointer variable. The remote memory location can be of 3 types: RAM memory (dm), RAM memory for TML programs (pm), EEPROM SPI-connected memory for TML programs (spi). If the pointer variable is followed by a + sign, after the assignment, the pointer variable is incremented by 1 if the source is a 16-bit integer or by 2 if the source is a 32-bit long or fixed

[2](p_var),spi = local_var;  // set local_var value in EEPROM program memory

       // location from axis 2, pointed by p_var from axis 2

[G3](p_var+),dm = long_var; // set local long_var value in RAM data memory

       // location from group 3 of axes, each location being

// pointed its own p_var, which is incremented by 2

[4](p_var+),pm = int_var;   // set local int_var value in RAM program memory

          // location from axis 4, pointed by p_var from axis 4;

// p_var is incremented by 1

Remark: The TML instructions for data transfers between axes use a short address format for the remote destination when this is a TML data. The short address format requires a destination address between 0x200 and 0x3FF or between 0x800 and 0x9FF. This restriction is respected now by all the predefined or user-defined TML data, hence you can use the above assignment instructions without checking the variables addresses.

However, considering possible future developments, the TML also includes data transfers using a full address format where the destination address can be any 16-bit value. The following command supports full addressing:

[G2]remote_var,dm = local_var; // set remote_var from group 2 with

// local_var value, using extended addressing

 

See also:

TML Description