TML Data

The TML works with the following categories of data:

TML Registers
TML Parameters
TML Variables
User Variables

All TML data are identified by their name. The names of the TML registers, parameters or variables are predefined and do not require to be declared. The names of the user variables are at your choice. You need to declare the user variables before using them.

The TML uses the following data types:

int                16-bit signed integer
uint                16-bit unsigned integer
fixed        32-bit fixed-point data with the 16MSB for the integer part and the 16LSB for the factionary part.
long                32-bit signed integer
ulong        32-bit unsigned integer

The data type uint or ulong are reserved for the TML predefined data. The user-defined variables are always signed. Hence you may declare them of type: int, fixed or long.

Remark: An unsigned TML data means that in the firmware its value is interpreted as unsigned. Typical examples: register values, time-related variables, protection limits for signals that may have only positive values like temperature or supply voltage, etc. However, the same data will interpreted as signed if it is used in a TML instruction whose operands are treated as signed values.

Each TML data has an associated address. This represents the address of the data memory location where the TML data exists. Address ranges for TML registers, variables and parameters are from 0x0200 to 0x03AF and from 0x0800 to 0x09FF. For user-defined variables the address range is between 0x03B0 and 0x03FF. In TML the data components may be addressed in several ways:

direct, using their name in the TML instruction mnemonic

Example:

CPOS = 2000; // write 2000 in CPOS parameter (command position)

indirect, using a pointer variable. The pointer value is the address of the data component to work with

Example:

user_var = 0x29E;        // write hexadecimal value 0x29E representing CPOS address in

                               // the user-defined pointer variable user_var

(user_var),dm = 2000;        // write 2000 in the data memory address pointed by

                                       // user_var i.e. in the CPOS parameter

direct with extended address, using the TML data name

Example:

CPOS,dm = 2000; // write 2000 in CPOS using direct mode with extended address

In the TML instructions the operands (variables) are grouped into 2 categories:

V16. In this category enter all the 16-bit data from all the categories: TML registers, TML parameters, TML variables, and user parameters. From the execution point of view, the TML makes no difference between them.
V32. In this category enter all the 32-bit data either long or fixed from all the categories: TML registers, TML parameters, TML variables, and user parameters. From the execution point of view, the TML makes no difference between them.

Remarks:

It is possible to address only the high or low part of a 32-bit data, using the suffix (H) or (L) after the variable name.

Examples:

CPOS(L) = 0x4321;        // write hexadecimal value 0x4321 in low part of CPOS

CPOS(H) = 0x8765;        // write hexadecimal value 0x8765 in high part of CPOS

                               // following the last 2 commands, CPOS = 0x87654321

The TML compiler always checks the data type. It returns an error if an operand has an incompatible data type or if the operands are not of the same type
A write operation using indirect addressing is performed on one or two words function of the data type. If the data is a 16-bit integer, the write is done at the specified address. If the data is fixed or long the write is performed at the specified address and the next one. A fixed data is recognized by the presence of the dot, for example: 2. or 1.5. A long variable is automatically recognized when its size is outside the 16-bit integer range or in case of smaller values by the presence of the suffix L, for example: 200L or –1L.

Examples:

user_var = 0x29E;        // write CPOS address in pointer variable user_var

(user_var),dm = 1000000;// write 1000000 (0xF4240) in the CPOS parameter i.e.

                                               // 0x4240 at address 0x29E and 0xF at next address 0x29F

(user_var),dm = -1;// write -1 (0xFFFF) in CPOS(L). CPOS(H) remains unchanged

(user_var),dm = -1L;// write –1 seen as a long variable (0xFFFFFFFF) in CPOS i.e.

             // CPOS(L) = 0xFFFF and  CPOS(H) = 0xFFFF

user_var = 0x2A0; // write CSPD address in pointer variable user_var

(user_var),dm = 1.5; // write 1.5 (0x18000) in the CSPD parameter i.e.

                                       // 0x8000 at address 0x2A0 and 0x1 at next address 0x2A1

In an indirect addressing, if the pointer variable if followed by + sign, it is automatically incremented by 1 or 2 depending on the data type: 1 for integer, 2 for fixed or long data.

Examples:

user_var = 0x29E; // write CPOS address in pointer variable user_var

(user_var+),dm = 1000L; // write 1000 seen as long in CPOS, then increment

                       // user_var by 2

(user_var+),dm = 1000; // write 1000 seen as int at address 0x29A (0x29E+2) ,

                       // then increment user_var by 1

 

TML Data categories:

TML Registers

TML Parameters

TML Variables

User Variables

 

Basic Concepts next topics:

Memory Map – Firmware version FAxx

Memory Map – Firmware version FBxx

AUTORUN mode

 

See also:

Basic Concepts

TML Description