=                Assign a 16-bit local TML variable with data got from another axis

Syntax                        

VAR16D = [Axis] VAR16S

local VAR16D = [Axis] VAR16S

VAR16D = [Axis] VAR16S, DM

local VAR16D = [Axis] VAR16S, DM

VAR16D = [Axis] (VAR16S), TypeMem

local VAR16D = [Axis] &(VAR16S), TM

VAR16D = [Axis] (VAR16S+), TypeMem

local VAR16D = [Axis] &(VAR16S), TM, then V16S+=1

 

Operands        VAR16x: integer variable VAR16x

               Axis: an integer 1 to 255 representing the Axis ID of the source axis

DM: data memory operand

TypeMem: memory operand. One of dm (0x1), pm (0x0) or spi (0x2) values

(VAR16x): contents of variable VAR16x, representing a 16-bit address of a variable

 

PlaceTML

Binary code

DescriptionAssigns a 16-bit local TML variable with data got from another axis. The source on the remote axis can be: a 16-bit TML variable or a memory location whose address is indicated by a 16-bit TML variable (a pointer) from the remote axis. If the pointer variable is followed by a + sign, after the assignment, it is incremented by 1.

Remark: If the TML variables from the remote axis are user variables, these must be declared in the local axis too. Moreover, for correct operation, these variables must have the same address in both axes, which means that they 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.

The memory location can be of 3 types: RAM for data (dm), RAM for TML programs (pm), EEPROM SPI-connected for TML programs (spi).

TypeMem

One instruction uses a 9-bit short address for the source variable. Bit value X specifies the destination address range:

Addressrange

All predefined or user-defined TML data are inside these address ranges, hence these instructions can be used without checking the variables addresses. However, considering future developments, the TML also includes assignment instructions using a full address where the destination address can be any 16-bit value. In this case destination variable is followed by “,dm”.  

 

Execution        Copies a 16-bit value from the remote source to the local destination

 

Example1        

int VarLoc, VarExt;

...

VarLoc = [15]VarExt;

 

Before instruction

 

After instruction

VarLoc on local axis

x

 

VarLoc on local axis

0x1234

VarExt on axis 15

0x1234

 

VarExt on axis 15

0x1234

 

Example2        

int VarLoc, VarExt;

...

VarLoc = [15]VarExt, dm;

 

Before instruction

 

After instruction

VarLoc on local axis

x

 

VarLoc on local axis

0x1234

VarExt on axis 15

0x1234

 

VarExt on axis 15

0x1234

 

Example3        

int VarLoc, pVarExt;

...

VarLoc = [15](pVarExt), dm;

 

Before instruction

 

After instruction

pVarExt on axis 15

0x1234

 

pVarExt on axis 15

0x1234

At dm address 0x1234 on axis 15

0xFEDC

 

At dm address 0x1234 on axis 15

0xFEDC

VarLoc on local axis

x

 

VarLoc on local axis

0xFEDC

 

Example4        

int VarLoc, pVarExt;

...

VarLoc = [15](pVarExt+), dm;

 

Before instruction

 

After instruction

pVarExt on axis 15

0x1234

 

pVarExt on axis 15

0x1235

At dm address 0x1234 on axis 15

0xFEDC

 

At dm address 0x1234 on axis 15

0xFEDD

VarLoc on local axis

x

 

VarLoc on local axis

0xFEDC