Special I/O – TML Programming Details (Firmware version FBxx) |
In TML, there are 5 inputs and 2 outputs that have dedicated functions. These are:
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:
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:
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:
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:
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
SRB ICR 0xFFFF,0x0040; //Set/Reset Bits of Interrupt Control Register SRB ICR 0xFFFF,0x0080; //Set/Reset Bits of Interrupt Control Register Remarks:
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:
When the programmed transition occurs on any capture or limit switch input, the following happens:
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:
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
SRB ICR 0xFFFF,0x0100; //Set/Reset Bits of Interrupt Control Register Remarks:
See also: Special I/O – Related TML Instructions and Data
|