General-purpose I/O – TML Programming Details (Firmware version FBxx)

In TML you can access up to 16 digital input and 16 digital output lines, numbered: 0 to 15. Each intelligent drive/motor has a specific number of inputs and outputs, therefore only a part of the 16 inputs or 16 outputs is used. The I/O numbering is common for all the products; hence each product has its own list of available I/Os. This is an ordered list. For example, a product with 4 inputs and 4 outputs can use the inputs: 0, 1, 2 and 3 and the outputs 0, 1, 2 and 3.

Remark: Read carefully the drive/motor user manual to find which I/O lines are available. Do not attempt to use the other I/Os. This may harm your drive/motor.

Some drives/motors include I/O lines that may be used either as inputs or as outputs. Before using these lines, you need to specify how you want to use them, with the TML commands:

SetAsInput(n);        //Set the IO line n as an input

SetAsOutput(n);        //Set the IO line n as an output

Remarks:

Check the drive/motor user manual to find how are set, after power-on, the I/O lines that may be used either as inputs or as outputs
You need to set an I/O line as input or output, only once, after power on  

You can read and save the status of an input with the TML command:

user_var = IN(n);        //Read IO line n data into variable user_var

where user_var is a 16-bit integer variable and n is the input number. If the input line is low (0 logic), user_var is set to 0, else user_var is set to a non-zero value.

You can set an output high (1 logic) or low (0 logic) with the following commands:

OUT(n)=value16;                // Set IO line n according with its corresponding bit from value16

Remark: Check the drive/motor user manual to find if the I/O lines you are using are passed directly or are inverted inside the drive/motor. If an I/O line is inverted, you need to switch high with low in the examples above, which refer to the I/O line status at the drive/motor connector level.  

Using TML command:

       user_var = IN(n1,n2,n3,…); // Set corresponding bits from a according with selected inputs status

you can read simultaneously and save in a 16-bit integer variable the status of the selected inputs.

The bits corresponding to these inputs are set as follows: 0 if the input is low and 1 if the input is high. The other bits of the variable are set to 0.

Remark: Each drive/motor contains in the TML parameter DIGIN_INVERSION_MASK an inversion mask for these inputs. A bit set to 1 in this mask, means that the corresponding input is inverted. The value set in user_var is obtained after a logical XOR between the inputs status and the inversion mask. As result, the bits in user_var always show correctly the inputs status at connectors level (0 if the input is low and 1 if the input is high) even when the inputs are inverted.

Using TML command:

       OUT(n1, n2, n3,…) = value16;        // Set outputs n1, n2, n3, … according with corresponding bits from value16

you can set simultaneously with the command value specified by a 16-bit integer variable, the selected outputs.

The outputs are set as follows: low if the corresponding bit in the variable is 0 and high if the corresponding bit in the variable is 1. The other bits of the variable are not used.

Remark: Each drive/motor contains in the TML parameter DIGOUT_INVERSION_MASK an inversion mask for these outputs. A bit set to 1 in this mask, means that the corresponding output is inverted. The commands effectively sent to the outputs are obtained after a logical XOR between the immediate or user_var value and the inversion mask. As result, the outputs at connectors level always correspond to the immediate or user_var command values (low if the bit is 0 and high if the bit is 1), even when the outputs are inverted.

General-purpose I/O – Related TML Instructions and Data

TML Description