Special I/O – TML Programming Details (Firmware version FBxx)

In TML, there are 5 inputs and 2 outputs that have dedicated functions. These are:

Enable input
2 limit switch inputs
2 capture inputs
Ready output
Error output

Remark: On some drives/motors only a part if these special I/O is available. When present, the capture and limit switch inputs and always connected to the same I/O numbers. However, the Enable input as well as the Ready and Error outputs may be assigned to other I/O lines. Their I/O number allocation is specific for each product.

The enable input is a safety input, and can be: active or inactive. On the active level, it enables normal operation. On the inactive level it disables the drive/motor similarly with the AXISOFF command. When the enable input goes from inactive to active level and AXISON command is automatically performed if ACR.1 = 1 or ACR.3 = 1.

The active level is programmable: low or high via TML parameter DIGIN_ACTIVE_LEVEL as follows:

If DIGIN_ACTIVE_LEVEL.15 = 1, Enable is active when the input is high
If DIGIN_ACTIVE_LEVEL.15 = 0, Enable is active when the input is low

Remark: The enable input high/low refers to the input level at drive/motor connector. After power on, the active level is set to enable normal operation with nothing connected on the input

The limit switch inputs main goal is to protect against accidental moves outside a defined working area. The protection involves connecting limit switches to:

LSP input to stop movement in positive direction
LSN input to stop movement in negative direction

A limit switch input can be: active or inactive. The active level is programmable: low or high via TML parameter DIGIN_ACTIVE_LEVEL as follows:

If DIGIN_ACTIVE_LEVEL.14 = 1, Limit Switch Negative is active when the input is high
If DIGIN_ACTIVE_LEVEL.14 = 0, Limit Switch Negative is active when the input is low
If DIGIN_ACTIVE_LEVEL.13 = 1, Limit Switch Positive is active when the input is high
If DIGIN_ACTIVE_LEVEL.13 = 1, Limit Switch Positive is active when the input is low

Remark: The limit switch inputs high/low refers to the inputs level at drive/motor connector. After power on, the active level is set to have both limit switches inactive with nothing connected on these inputs

When positive limit switch input is active, movement is possible only in the negative direction. Any attempt to move in the positive direction will set the drive/motor in quick stop mode, and this will stop the move with the deceleration rate set in TML parameters CDEC.

When negative limit switch input is active, movement is possible only in the positive direction. Any attempt to move in the negative direction will set the drive/motor in quick stop mode, and this will stop the move with the deceleration rate set in TML parameters CDEC.

Remark: The drive/motor exits from quick stop mode only by setting a new motion mode.

The limit switch inputs may also be used as capture inputs due to their capability to sense low to high or high to low transitions and to capture the motor, load or master position when these transitions occur. The limit switch inputs capturing behavior is identical with that of the capture inputs and therefore is presented below together with the capture inputs.

You can set either an event or a TML interrupt, for each limit switch input, to detect when a programmed transition has occurred. In both cases you need to:

1.Enable limit switch input capability to detect a low->high or a high-> low transition with one of the following TML instructions:

ENLSP0;        //Enable Positive Limit Switch to detect a high->low transition

ENLSP1;        //Enable Positive Limit Switch to detect a low->high transition

ENLSN0;        //Enable Negative Limit Switch to detect a high->low transition

ENLSN1;        //Enable Negative Limit Switch to detect a low->high transition

2.Set:
A limit switch event with !LSP or !LSN, then wait until the event occurs with WAIT!;, or
Enable the LSP or LSN TML interrupt with the TML commands:

SRB ICR 0xFFFF,0x0040; //Set/Reset Bits of Interrupt Control Register

SRB ICR 0xFFFF,0x0080; //Set/Reset Bits of Interrupt Control Register

Remarks:

The main task of the limit switches i.e. to protect against accidental moves outside the working area is performed independently of the fact that limit switches may be enabled or not to detect transitions
A limit switch input capability to detect transitions is automatically disabled, after the programmed transition was detected. In order to reuse it, you need to enable it again.
You may also disable a limit switch input capability to detect transitions, using the TML commands: DISLSP, DISLSN

You can also use the limit switch inputs as general-purpose inputs by disabling their capability to protect against accidental moves outside a defined working area. For this you need to set TML parameter LSACTIVE = 1. This command, doesn’t affect the limit switch inputs capability to detect transitions.

Remark: After power on, LSACTIVE = 0 and the limit switches are active.

You can read the limit switches inputs, at any moment, independently of LSACTIVE value, like any other inputs using the TML instructions:

var = IN#2;                // read status of the positive limit switch input

var = IN#24;        // read status of the negative limit switch input

The capture inputs are special inputs that can be programmed to sense either a low to high or high to low transition and capture the motor, load or master position with very high accuracy when these transitions occur.

Typically, the 1st encoder index is connected to the 1st capture input – #5/CAPI, and the 2nd encoder index is connected to the 2nd capture input – #34/2CAPI.

When an incremental encoder provides the motor position, its signals are always connected to the 1st encoder interface. When an incremental encoder provides the master position, its signals are always connected to the 2nd encoder interface. When an incremental encoder provides the load position, its signals are connected to:

2nd encoder interface, if there is another sensor on the motor (for example DC motor with encoder on load and tachometer on the motor)
1st encoder interface, if there is no other sensor on the motor (for example steppers controlled open-loop with an encoder on the load)  

When the programmed transition occurs on any capture or limit switch input, the following happens:

Motor position APOS_MT is captured and memorized in the TML variable CAPPOS, except the case of open-loop systems, where reference position TPOS is captured instead
Master position APOS2 or load position APOS_LD is captured and memorized in the TML variable CAPPOS2, except the case of steppers controlled open loop with an encoder on the load, when load position is captured in CAPPOS.

The selection between master and load position is done as follows: load position is saved in CAPPOS2 only for the setup configurations which use different sensors for load and motor and foresee a transmission ratio between them. For all the other setup configurations, the master position is saved in CAPPOS2. The master position is automatically computed when pulse and direction signals or quadrature encoder signals are connected to their dedicated inputs.

When an incremental encoder is connected to the 1st encoder interface and 1st capture/encoder index detects the programmed transition, the position captured in CAPPOS is very accurate, being read in less than 200 ns after the input transition. The position captured in CAPPOS2 is also accurate being read with a maximum delay of 5μs.

When an incremental encoder is connected to the 2nd encoder interface or when master position is set via pulse & direction signals and 2nd capture/encoder index detects the programmed transition, the position captured in CAPPOS2 is very accurate, being read in less than 200 ns, after the input transition. The position captured in CAPPOS2 is read with a maximum delay of 5μs.  

When any of the 2 limit switch inputs detects the programmed transition, the positions captured in CAPPOS and CAPPOS2 are accurate, both being read with a maximum delay of 5μs.

You can set either an event or a TML interrupt on a capture input. In both cases you need to:

1.Enable the capture input for the detection of a low->high or a high-> low transition with one of the following TML instructions:

ENCAPI0;        //Activate CAPI input to trigger a rising transitions

ENCAPI1;        //Activate CAPI input to trigger a falling transitions

EN2CAPI0;        //Activate CAPI input to trigger a rising transitions

EN2CAPI1;        //Activate CAPI input to trigger a falling transitions

2.Set:
A capture event with !CAP, then wait until the event occurs with WAIT!;, or
Enable the TML capture interrupt with the TML command:

SRB ICR 0xFFFF,0x0100; //Set/Reset Bits of Interrupt Control Register

Remarks:

If both capture inputs are activated in the same time, the capture event and the TML capture interrupt flag is set by the capture input that is triggered first. The capture event or the TML capture interrupt makes no difference between the two capture inputs.
When the programmed transition is detected, the capture input is automatically disabled. In order to reuse it, you need to enable it again for the desired transition
You may also disable a capture input (i.e. its capability to detect a programmed transition) previously enabled, using the TML commands: DISCAPI, DIS2CAPI

 

See also:

Special I/O – Related TML Instructions and Data

TML Description